Class UseBlockEvent.Pre

All Implemented Interfaces:
ICancellableEcsEvent
Enclosing class:
UseBlockEvent

public static final class UseBlockEvent.Pre extends UseBlockEvent implements ICancellableEcsEvent
An event that is called before an entity interacts with a block in the world.

If cancelled, the interaction will return as failed.

  • Constructor Details

    • Pre

      public Pre(@Nonnull InteractionType interactionType, @Nonnull InteractionContext context, @Nonnull org.joml.Vector3i targetBlock, @Nonnull BlockType blockType)
      Default Constructor for a UseBlockEvent.Pre instance.
      Parameters:
      interactionType - The type of interaction being performed.
      context - The context of the interaction.
      targetBlock - The position of the block being interacted with.
      blockType - The BlockType of the block being interacted with.
  • Method Details

    • isCancelled

      public boolean isCancelled()
      Description copied from interface: ICancellableEcsEvent
      Returns whether this event has been cancelled.
      Specified by:
      isCancelled in interface ICancellableEcsEvent
      Returns:
      true if the event is cancelled, false otherwise.
    • setCancelled

      public void setCancelled(boolean cancelled)
      Description copied from interface: ICancellableEcsEvent
      Changes whether this event has been cancelled or not.
      Specified by:
      setCancelled in interface ICancellableEcsEvent
      Parameters:
      cancelled - Whether the event should be cancelled.