Class ItemTransportingEntitySortEvent

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

@NullMarked public class ItemTransportingEntitySortEvent extends EntityEvent
Called when an item-transporting entity (ex a CopperGolem) is inspecting a destination Container to decide if the item it is holding belongs in said container.
This gives plugin developers an opportunity to override the CopperGolem's sorting behavior.
Note: This event can be called twice during a single "interaction", once before the container is opened, and again before items are added and the container is closed.
  • Field Details

    • HANDLER_LIST

      protected static final HandlerList HANDLER_LIST
  • Constructor Details

  • Method Details

    • setResult

      public void setResult(Event.Result result)
      Sets the sorting decision for the held item and the inspected container.
      Parameters:
      result - the sorting decision
      See Also:
    • getResult

      public Event.Result getResult()
      Gets the current sorting decision. Starts as Event.Result.DEFAULT and may have been modified by other plugins.
      Returns:
      the current sorting decision
      See Also:
    • getContainerInventory

      public Inventory getContainerInventory()
      Gets the inventory of the container the entity is comparing against the held item.
      Returns:
      the inventory of the potential destination container
    • getItemStack

      public ItemStack getItemStack()
      Clone of the ItemStack held by the entity that is being compared against the container.
      Returns:
      The held ItemStack
    • getHandlers

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

      public static HandlerList getHandlerList()