Class BreakBlockEvent

All Implemented Interfaces:
ICancellableEcsEvent

public class BreakBlockEvent extends CancellableEcsEvent
An event that is called when a block is broken in the world.

If cancelled, the block will not be broken.

  • Constructor Details

    • BreakBlockEvent

      public BreakBlockEvent(@Nullable ItemStack itemInHand, @Nonnull org.joml.Vector3i targetBlock, @Nonnull BlockType blockType)
      Default Constructor for a BreakBlockEvent instance.
      Parameters:
      itemInHand - The item in the instigating entity's hand, if any.
      targetBlock - The position of the block being broken.
      blockType - The BlockType of the block being broken.
  • Method Details

    • getItemInHand

      @Nullable public ItemStack getItemInHand()
      Returns:
      the item in the instigating entity's hand, or null if none.
    • getTargetBlock

      @Nonnull public org.joml.Vector3i getTargetBlock()
      Returns:
      the position of the block being broken.
    • getBlockType

      @Nonnull public BlockType getBlockType()
      Returns:
      the BlockType of the block being broken.
    • setTargetBlock

      public void setTargetBlock(@Nonnull org.joml.Vector3i targetBlock)
      Parameters:
      targetBlock - The new target block position.