Changes

262 bytes added ,  13:46, 12 January 2022
Update to 1.18
Line 34: Line 34:  
==== Return Value ====
 
==== Return Value ====
   −
<code><nowiki>InteractionResult</nowiki></code> is the result right clicking, see example usages below. <code><nowiki>InteractionResult.SUCCESS</nowiki></code> means the right click action was successful. <code><nowiki>InteractionResult.CONSUME</nowiki></code> means that the right click action was consumed. <code><nowiki>InteractionResult.PASS</nowiki></code> is the default behavior, for when the block has no right click behavior, and allows something else to handle the right click. <code><nowiki>InteractionResult.FAIL</nowiki></code> means that the action failed.
+
<code><nowiki>InteractionResult</nowiki></code> is the result right clicking, see example usages below. <code><nowiki>InteractionResult.SUCCESS</nowiki></code> means the right click action was successful. <code><nowiki>InteractionResult.CONSUME</nowiki></code> means that the right click action was consumed. <code><nowiki>InteractionResult.CONSUME_PARTIAL</nowiki></code> means that the right click action is being consumed. <code><nowiki>InteractionResult.PASS</nowiki></code> is the default behavior, for when the block has no right click behavior, and allows something else to handle the right click. <code><nowiki>InteractionResult.FAIL</nowiki></code> means that the action failed.
    
{| class="wikitable sortable" border=1
 
{| class="wikitable sortable" border=1
Line 42: Line 42:  
|-
 
|-
 
|    <code><nowiki>CONSUME</nowiki></code>  ||  Tuning a noteblock.                                               
 
|    <code><nowiki>CONSUME</nowiki></code>  ||  Tuning a noteblock.                                               
 +
|-
 +
| <code><nowiki>CONSUME_PARTIAL</nowiki></code> ||  Eating a carrot.                                           
 
|-
 
|-
 
|    <code><nowiki>PASS</nowiki></code>    ||  When right-clicking dirt. Or any other basic block.               
 
|    <code><nowiki>PASS</nowiki></code>    ||  When right-clicking dirt. Or any other basic block.               
Line 127: Line 129:  
Two blocks that override this method are the <code>NoteBlock</code> and the <code>RedstoneOreBlock</code>.
 
Two blocks that override this method are the <code>NoteBlock</code> and the <code>RedstoneOreBlock</code>.
   −
Note blocks override this method so that when left-clicked, it plays a sound.   
+
<code>NoteBlock</code> override this method so that when left-clicked, it plays a sound.   
Redstone ore overrides this method so that when left-clicked, it gives off emits faint light for a few seconds.
+
<code>RedStoneOreBlock</code> overrides this method so that when left-clicked, it gives off emits faint light for a few seconds.
    
== playerWillDestroy ==
 
== playerWillDestroy ==
Line 160: Line 162:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
The <code>TNTBlock</code> overrides this method to cause it's explosion when a player destroys it if its <code>unstable</code> property is <code>true</code>.   
+
The <code>TntBlock</code> overrides this method to cause it's explosion when a player destroys it if its <code>unstable</code> property is <code>true</code>.   
 
This method is used by extended pistons; since an extended piston is made up of two blocks: the extended head and the base.
 
This method is used by extended pistons; since an extended piston is made up of two blocks: the extended head and the base.
 
The <code>PistonHeadBlock</code> makes use of this method to destroy the base block when the moving head is destroyed.  
 
The <code>PistonHeadBlock</code> makes use of this method to destroy the base block when the moving head is destroyed.