Class BlockEvent.BlockToolInteractEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.world.BlockEvent
net.minecraftforge.event.world.BlockEvent.BlockToolInteractEvent
Enclosing class:
BlockEvent

public static class BlockEvent.BlockToolInteractEvent extends BlockEvent
Fired when when this block is right clicked by a tool to change its state. For example: Used to determine if an axe can strip or a shovel can path. For hoes, see net.minecraft.world.item.HoeItem#TILLABLES and UseHoeEvent. This event is Cancelable. If canceled, this will prevent the tool from changing the block's state.
  • Field Details

  • Constructor Details

  • Method Details

    • getPlayer

      public Player getPlayer()
      Gets the player using the tool.
    • getHeldItemStack

      public ItemStack getHeldItemStack()
      Gets the tool being used.
    • getToolAction

      public ToolAction getToolAction()
      Gets the action being performed.
    • setFinalState

      public void setFinalState(BlockState finalState)
      Sets the transformed state after tool use. If not set, will return the original state. This will be bypassed if canceled returning null instead.
    • getFinalState

      public BlockState getFinalState()
      Gets the transformed state after tool use. If setFinalState not called, will return the original state. This will be bypassed if canceled returning null instead.