📣Events
The "events" section of a block or item's YAML allows you to execute Minecraft commands when certain interactions are performed.
# "events" is formatted as a list of event objects:
events:
- onRightClick: # <-- event name
commands:
- say block right clicked!
cooldown: 20 # <-- cooldown in ticks
- onBroken:
commands:
# this is a list of Minecraft commands, with or without the slash
- say block broken!
- say goodbye world!
# adding a cooldown is optionalList of event names
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.
Last updated