Skip to content

LivingEntityInventoryChangeEvent

Package: com.hypixel.hytale.server.core.event.events.entity Extends: EntityEvent<LivingEntity, String> Implements: IEvent<String> Cancellable: No

Standard event dispatched when a living entity’s inventory changes. This event fires from multiple inventory operations and provides the affected item container and the transaction that describes the change. This event cannot be cancelled — it is a notification of a change that has already occurred.

FieldTypeAccessorMutableNullable
entityLivingEntitygetEntity()NoNo
itemContainerItemContainergetItemContainer()NoNo
transactionTransactiongetTransaction()NoNo
  • entity — The living entity whose inventory changed. Inherited from EntityEvent.
  • itemContainer — The item container that was modified.
  • transaction — The transaction describing the inventory change (items added, removed, or moved).

This event is dispatched from multiple sites within the Inventory class, covering various inventory mutation operations:

  • Inventory (lines 183, 195, 209, 247, 285, 302) via eventBus dispatchFor — EventBus keyed dispatch from multiple inventory change operations.
getEventRegistry().register(LivingEntityInventoryChangeEvent.class, event -> {
LivingEntity entity = event.getEntity();
ItemContainer container = event.getItemContainer();
Transaction transaction = event.getTransaction();
// Example: log inventory changes for a specific entity type
logInventoryChange(entity, container, transaction);
});
  • PlayerCraftEvent — Deprecated event that fires specifically for crafting operations, which also result in inventory changes.