Triggers trigger/player_interact

Player Interact Trigger

Fires when a player clicks a block or air. Optionally filter by action type.

Note: Fires twice per click in some situations due to main-hand / off-hand. Cancel with Event Cancel to prevent default behaviour.

Outputs

NameTypeDescription
exec exec Fires on player interaction.
player player The player who interacted.
action string Action type: RIGHT_CLICK_BLOCK, LEFT_CLICK_BLOCK, RIGHT_CLICK_AIR, LEFT_CLICK_AIR, PHYSICAL.
block string Material of the clicked block (empty if air).
item string Material of the item held in the player's main hand (empty if hand is empty).
location location Location of clicked block (or player location for air clicks).

Properties

KeyTypeDefaultDescription
action string "" Leave blank for any interaction, or specify e.g. RIGHT_CLICK_BLOCK.

Examples

Custom button on right-click

Trigger logic when a player right-clicks a button block.

  1. Set Action Filter to RIGHT_CLICK_BLOCK
  2. Use a Branch node to check block == STONE_BUTTON
  3. Execute your custom logic on the True branch