Class ItemTransportingEntitySortEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
io.papermc.paper.event.entity.ItemTransportingEntitySortEvent
Called when an item-transporting entity (ex a
This gives plugin developers an opportunity to override the
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.
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class Event
Event.Result -
Field Summary
FieldsFields inherited from class EntityEvent
entity -
Constructor Summary
ConstructorsConstructorDescriptionItemTransportingEntitySortEvent(Entity entity, ItemStack itemStack, Inventory containerInventory) -
Method Summary
Modifier and TypeMethodDescriptionGets the inventory of the container the entity is comparing against the held item.static HandlerListClone of the ItemStack held by the entity that is being compared against the container.Gets the current sorting decision.voidsetResult(Event.Result result) Sets the sorting decision for the held item and the inspected container.Methods inherited from class EntityEvent
getEntity, getEntityTypeMethods inherited from class Event
callEvent, getEventName, isAsynchronous
-
Field Details
-
HANDLER_LIST
-
-
Constructor Details
-
ItemTransportingEntitySortEvent
-
-
Method Details
-
setResult
Sets the sorting decision for the held item and the inspected container.Event.Result.ALLOW: the item belongs in the container.Event.Result.DENY: the item does not belong in the container.Event.Result.DEFAULT: use the vanilla sorting logic.
- Parameters:
result- the sorting decision- See Also:
-
getResult
Gets the current sorting decision. Starts asEvent.Result.DEFAULTand may have been modified by other plugins.- Returns:
- the current sorting decision
- See Also:
-
getContainerInventory
Gets the inventory of the container the entity is comparing against the held item.- Returns:
- the inventory of the potential destination container
-
getItemStack
Clone of the ItemStack held by the entity that is being compared against the container.- Returns:
- The held ItemStack
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-