Last updated
Last updated
Both blocks and items use some events by the same name, with them behaving differently depending on the context: for example, onBroken
is used for both when a block is broken and for when an item breaks as a result of running out of durability.
onRightClick
:
Function: Triggered when a block or item is right-clicked.
onLeftClick
:
Function: Triggered when a block or item is left-clicked.
onRightClickAir
:
Function: Triggered when an item is right-clicked while looking at air.
onLeftClickAir
:
Function: Triggered when an item or block is left-clicked while looking at air.
onRightClickBlock
:
Function: Triggered when the player is looking at a block and a right-click is performed.
onLeftClickBlock
:
Function: Triggered when the player is looking at a block and a left-click is performed.
onPlaced
:
Function: Triggered when a block is placed.
onBroken
:
Function: Triggered when a block or item is broken.
onDamaged
:
Function: Triggered when an item or block is damaged.
onPushed
:
Function: Triggered when a block is pushed by a piston.
The "events" section of a block or item's YAML allows you to execute Minecraft commands when certain interactions are performed.