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, a shovel can path, or a hoe can till. 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 PlayerEntity getPlayer()
      Gets the player using the tool.
    • getHeldItemStack

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

      public ToolType getToolType()
      Gets the current type of the tool being compared against.
    • 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.