<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://forge.gemwire.uk/index.php?action=history&amp;feed=atom&amp;title=Block_Interaction%2F1.16</id>
	<title>Block Interaction/1.16 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://forge.gemwire.uk/index.php?action=history&amp;feed=atom&amp;title=Block_Interaction%2F1.16"/>
	<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Block_Interaction/1.16&amp;action=history"/>
	<updated>2026-05-01T18:02:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Block_Interaction/1.16&amp;diff=2749&amp;oldid=prev</id>
		<title>ShrimpBot: Copy Block Interaction to MC1.16 archive</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Block_Interaction/1.16&amp;diff=2749&amp;oldid=prev"/>
		<updated>2021-07-27T04:13:41Z</updated>

		<summary type="html">&lt;p&gt;Copy &lt;a href=&quot;/wiki/Block_Interaction&quot; title=&quot;Block Interaction&quot;&gt;Block Interaction&lt;/a&gt; to MC1.16 archive&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 04:13, 27 July 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l64&quot; &gt;Line 64:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 64:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Another common use for activation is, well, activation. This can be something like &amp;quot;turning on&amp;quot; a block, or triggering it to perform some action. For instance, a block could light up when activated. A vanilla example would be buttons or levers.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Another common use for activation is, well, activation. This can be something like &amp;quot;turning on&amp;quot; a block, or triggering it to perform some action. For instance, a block could light up when activated. A vanilla example would be buttons or levers.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Tip/Important|&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;onBlockActivated&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is called on both the client and the server, so be sure to keep the [[Sides&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;|sidedness&lt;/del&gt;/1.16]] of your code in mind. Many things, like opening GUIs and modifying the world, should only be done on the server-side.}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Tip/Important|&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;onBlockActivated&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is called on both the client and the server, so be sure to keep the [[Sides/1.16&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;|sidedness&lt;/ins&gt;]] of your code in mind. Many things, like opening GUIs and modifying the world, should only be done on the server-side.}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>ShrimpBot</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Block_Interaction/1.16&amp;diff=2684&amp;oldid=prev</id>
		<title>ShrimpBot: Copy Block Interaction to MC1.16 archive</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Block_Interaction/1.16&amp;diff=2684&amp;oldid=prev"/>
		<updated>2021-07-27T03:58:01Z</updated>

		<summary type="html">&lt;p&gt;Copy &lt;a href=&quot;/wiki/Block_Interaction&quot; title=&quot;Block Interaction&quot;&gt;Block Interaction&lt;/a&gt; to MC1.16 archive&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;There are many different ways players (and other things) can interact with blocks, such as right clicking, left clicking, colliding, walking on, and of course mining.&lt;br /&gt;
&lt;br /&gt;
This page will cover the basics of the most common types of interaction with blocks.&lt;br /&gt;
&lt;br /&gt;
== Player Right Click ==&lt;br /&gt;
Since left clicking, or &amp;quot;punching&amp;quot;, a block does not generally result in any unique behavior, it is probably fair to say right clicking, or &amp;quot;activation&amp;quot;, is ''the''  most common method of interaction. And thankfully, it is also one of the simplest to handle.&lt;br /&gt;
&lt;br /&gt;
=== onBlockActivated ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the method that controls right click behavior.&lt;br /&gt;
&lt;br /&gt;
==== Parameters ====&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=1&lt;br /&gt;
!             Type          !!         Name         !!                  Description                  &lt;br /&gt;
|-&lt;br /&gt;
|        &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;BlockState&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;       ||    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;state&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;     ||  The state of the block that was clicked       &lt;br /&gt;
|-&lt;br /&gt;
|          &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;World&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;          ||   &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;worldIn&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;    ||  The world that the block was clicked in       &lt;br /&gt;
|-&lt;br /&gt;
|         &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;BlockPos&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;        ||     &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;pos&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;      ||  The position of the block that was clicked    &lt;br /&gt;
|-&lt;br /&gt;
|       &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;PlayerEntity&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;      ||    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;player&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;    ||  The player who did the clicking               &lt;br /&gt;
|-&lt;br /&gt;
|           &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Hand&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;          ||    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;handIn&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;    ||  The hand with which the player clicked        &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;BlockRayTraceResult&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;   ||     &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;hit&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;      ||  Where on the block's bounds it was hit        &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Return Value ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ActionResultType&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is the result right clicking, see example usages below. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ActionResultType.SUCCESS&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; means the right click action was successful. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ActionResultType.CONSUME&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; means that the right click action was consumed. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ActionResultType.PASS&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is the default behavior, for when the block has no right click behavior, and allows something else to handle the right click. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ActionResultType.FAIL&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; means that the action failed.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=1&lt;br /&gt;
!     Enum Value   !!                           Example Usage                          &lt;br /&gt;
|-&lt;br /&gt;
|    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;SUCCESS&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;   ||  Eating a slice of cake.                                          &lt;br /&gt;
|-&lt;br /&gt;
|    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;CONSUME&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;   ||  Tuning a noteblock.                                              &lt;br /&gt;
|-&lt;br /&gt;
|     &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;PASS&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;     ||  When right-clicking dirt. Or any other basic block.              &lt;br /&gt;
|-&lt;br /&gt;
|     &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;FAIL&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;     ||  When attempting to place a minecart on a block other than rails. &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Tip/Important|Returning &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ActionResultType.CONSUME&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; from this method on the client will prevent it being called on the server. It is common practice to just check &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;worldIn.isRemote&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and return &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ActionResultType.SUCCESS&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, and otherwise go on to normal activation logic. Vanilla has many examples of this, such as the chest.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Usage examples ===&lt;br /&gt;
&lt;br /&gt;
The uses for activation are literally endless. However, there are some common ones which deserve their own section.&lt;br /&gt;
&lt;br /&gt;
==== GUIs ====&lt;br /&gt;
&lt;br /&gt;
One of the most common things to do on block activation is opening a GUI. Many blocks in vanilla behave this way, such as chests, hoppers, furnaces, and many more. More about GUIs can be found on [their page](GUIs).&lt;br /&gt;
&lt;br /&gt;
==== Activation ====&lt;br /&gt;
&lt;br /&gt;
Another common use for activation is, well, activation. This can be something like &amp;quot;turning on&amp;quot; a block, or triggering it to perform some action. For instance, a block could light up when activated. A vanilla example would be buttons or levers.&lt;br /&gt;
&lt;br /&gt;
{{Tip/Important|&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;onBlockActivated&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is called on both the client and the server, so be sure to keep the [[Sides|sidedness/1.16]] of your code in mind. Many things, like opening GUIs and modifying the world, should only be done on the server-side.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Block Placement ==&lt;br /&gt;
&lt;br /&gt;
=== onBlockPlacedBy ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; &amp;gt;&lt;br /&gt;
public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Called by ''BlockItem''s after a block is set in the world, to allow post-place logic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parameters ===&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=1&lt;br /&gt;
!          Type         !!       Name         !!                  Description                  &lt;br /&gt;
|-&lt;br /&gt;
|      &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;World&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;      ||   &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;worldIn&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;    ||  The world that the block was placed in        &lt;br /&gt;
|-&lt;br /&gt;
|     &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;BlockPos&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;    ||     &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;pos&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;      ||  The position where the block was placed       &lt;br /&gt;
|-&lt;br /&gt;
|    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;BlockState&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;   ||    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;state&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;     ||  The state of the block that was placed        &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;LivingEntity&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;  ||    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;placer&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;    ||  The entity who placed the block               &lt;br /&gt;
|-&lt;br /&gt;
|    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ItemStack&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;    ||    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;stack&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;     ||  The item block that was placed                &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Player Break/Destroy ==&lt;br /&gt;
&lt;br /&gt;
=== onBlockClicked ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public void onBlockClicked(BlockState state, World worldIn, BlockPos pos, PlayerEntity player)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Called on a block when it is clicked by a player.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Info |content=This method is for when the player ''left-clicks'' on a block.&amp;lt;br&amp;gt;&lt;br /&gt;
Don't get this confused with &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;onBlockActivated&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, which is called when the player ''right-clicks''.}}&lt;br /&gt;
&lt;br /&gt;
=== Parameters ===&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=1&lt;br /&gt;
!          Type         !!       Name         !!                  Description                  &lt;br /&gt;
|-&lt;br /&gt;
|    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;BlockState&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;   ||    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;state&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;     ||  The state of the block that was clicked       &lt;br /&gt;
|-&lt;br /&gt;
|      &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;World&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;      ||   &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;worldIn&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;    ||  The world that the block was clicked in       &lt;br /&gt;
|-&lt;br /&gt;
|     &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;BlockPos&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;    ||     &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;pos&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;      ||  The position of the block that was clicked    &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;PlayerEntity&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;  ||    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;player&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;    ||  The player who did the clicking               &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Usage example ===&lt;br /&gt;
This method is perfect for adding custom events when a player clicks on a block.&lt;br /&gt;
&lt;br /&gt;
By default this method does nothing.  &lt;br /&gt;
Two blocks that override this method are the &amp;lt;code&amp;gt;NoteBlock&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;RedstoneOreBlock&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note blocks override this method so that when left-clicked, it plays a sound.  &lt;br /&gt;
Redstone ore overrides this method so that when left-clicked, it gives off emits faint light for a few seconds.&lt;br /&gt;
&lt;br /&gt;
== onBlockHarvested ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public void onBlockHarvested(World worldIn, BlockPos pos, BlockState state, PlayerEntity player)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Called before the Block is set to air in the world. Called regardless of if the player's tool can actually collect this block.&lt;br /&gt;
&lt;br /&gt;
=== Parameters ===&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=1&lt;br /&gt;
!          Type         !!        Name       !!                 Description                  &lt;br /&gt;
|-&lt;br /&gt;
|      &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;World&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;      ||   &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;worldIn&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;   ||  The world that the block was destroyed       &lt;br /&gt;
|-&lt;br /&gt;
|    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;BlockPos&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;     ||     &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;pos&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;     ||  The position of the block that was destroyed &lt;br /&gt;
|-&lt;br /&gt;
|    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;BlockState&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;   ||    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;state&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;    ||  The state of the block that was destroyed    &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;PlayerEntity&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;  ||    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;player&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;   ||  The player who harvested the block           &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Usage example ===&lt;br /&gt;
This method is perfect for adding custom events as a result of a player destroying a block&lt;br /&gt;
&lt;br /&gt;
This method has important behavior in the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Block&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; class so be sure to call the super method.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; &amp;gt;&lt;br /&gt;
super.onBlockHarvested(worldIn, pos, state, player);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;TNTBlock&amp;lt;/code&amp;gt; overrides this method to cause it's explosion when a player destroys it.  &lt;br /&gt;
This method is used by extended pistons; since an extended piston is made up of two blocks. (the extended head and the base)&lt;br /&gt;
The &amp;lt;code&amp;gt;PistonHeadBlock&amp;lt;/code&amp;gt; makes use of this method to destroy the base block when the moving head is destroyed. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Entity Collision ==&lt;br /&gt;
&lt;br /&gt;
== onEntityCollision ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is called whenever an entity collides with the block.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parameters ===&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=1&lt;br /&gt;
!         Type          !!       Name        !!                    Description                   &lt;br /&gt;
|-&lt;br /&gt;
|    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;BlockState&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;   ||    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;state&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;    ||  The state of the block that was collided with    &lt;br /&gt;
|-&lt;br /&gt;
|      &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;World&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;      ||   &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;worldIn&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;   ||  The world where the collided block is located    &lt;br /&gt;
|-&lt;br /&gt;
|    &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;BlockPos&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;     ||     &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;pos&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;     ||  The position of the block that was collided with &lt;br /&gt;
|-&lt;br /&gt;
|     &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Entity&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;      ||   &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;entityIn&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;  ||  The entity who collided with the block           &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Usage examples ===&lt;br /&gt;
&lt;br /&gt;
An example use of this method is by the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;CampfireBlock&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; which uses this method to light those on fire that collide with the campfire.&lt;/div&gt;</summary>
		<author><name>ShrimpBot</name></author>
	</entry>
</feed>