Class ItemTransportingEntityValidateTargetEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
io.papermc.paper.event.entity.ItemTransportingEntityValidateTargetEvent

@NullMarked public class ItemTransportingEntityValidateTargetEvent extends EntityEvent
Called when an item-transporting entity (typically a CopperGolem, although other entities may be possible through non-API means) is searching for or validating an existing target container block for taking or depositing items.

This may be called multiple times per entity per tick, so listeners should be careful to implement checks in an efficient manner.

  • Field Details

    • HANDLER_LIST

      protected static final HandlerList HANDLER_LIST
  • Constructor Details

    • ItemTransportingEntityValidateTargetEvent

      @Internal public ItemTransportingEntityValidateTargetEvent(Entity entity, Block block)
  • Method Details

    • setAllowed

      public void setAllowed(boolean allowed)
      Sets if the entity is allowed to use getBlock() as a target.
      Parameters:
      allowed - whether the target is allowed
    • isAllowed

      public boolean isAllowed()
      Gets if the entity is allowed to use getBlock() as a target.
      Returns:
      true if the target is allowed
    • getBlock

      public Block getBlock()
      Gets the target block the entity is validating.
      Returns:
      the target block
    • getHandlerList

      public static HandlerList getHandlerList()
    • getHandlers

      public HandlerList getHandlers()
      Specified by:
      getHandlers in class Event