Class PetPickupItemEvent

All Implemented Interfaces:
Cancellable

public class PetPickupItemEvent extends CancellablePetEvent
Fired when a pet with the Pickup skill is about to grab an Item entity off the ground. Listeners receive the live world Item entity before it is despawned and inserted into the pet's backpack.

Fires from PickupImpl during the proximity scan that runs every Pickup tick, once per item entity that passes the skill's filter — distance, cooldown, item-type allow/blocklist.

Cancellable: cancellation leaves the Item on the ground and aborts the pickup. The pet won't re-attempt the same item until the Pickup tick comes back around.

Pet state: live pet, with the owner online

Related events: PetInventoryActionEvent fires immediately after this on the PetInventoryActionEvent.Action.PICKUP branch, with the same can-cancel semantics. Listen here for per-item filtering and to that event for per-action veto control.

  • Constructor Details

    • PetPickupItemEvent

      public PetPickupItemEvent(Pet pet, Item item)
      Creates the event for a pending item pickup.
      Parameters:
      pet - the pet performing the pickup
      item - the ground item it is about to grab
  • Method Details

    • getHandlerList

      public static HandlerList getHandlerList()
      Returns the handler list for this event type.
      Returns:
      the shared HandlerList every PetPickupItemEvent is dispatched through
    • getHandlers

      public @NonNull HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getPet

      public Pet getPet()
      The pet about to pick the item up.
      Specified by:
      getPet in class PetEvent
      Returns:
      the pet performing the pickup
    • getItem

      public Item getItem()
      The ground item entity, still in the world and not yet despawned.
      Returns:
      the ground item it is about to grab