Interface PetEquipment

All Superinterfaces:
Pet, Scheduler, StoredPet

public interface PetEquipment extends Pet
Marker for pet types that can wear or hold equipment (armor, weapons, saddles). The equipment is persisted in the pet's NBT info blob and re-applied by PetVisualSyncer after each spawn.

Not all slots are valid for every pet type — horses use BODY/SADDLE, zombies use the full humanoid set. Implementations override getAllowedSlotNames() to declare which slots are available.

  • Method Details

    • getEquipment

      ItemStack[] getEquipment()
      Returns all currently equipped items, indexed by slot ordinal.
      Returns:
      every equipped item, indexed by slot
    • getEquipment

      ItemStack getEquipment(EquipmentSlot slot)
      Returns the item in the given slot, or null if empty.
      Parameters:
      slot - the slot to read
      Returns:
      the item in that slot, or null when empty
    • setEquipment

      void setEquipment(EquipmentSlot slot, ItemStack item)
      Equips an item in the given slot (persisted across despawns).
      Parameters:
      slot - the slot to fill
      item - the item to place, or null to clear
    • dropEquipment

      void dropEquipment()
      Drops all equipment as world items at the pet's location.
    • getAllowedSlotNames

      default Set<String> getAllowedSlotNames()
      Returns the set of equipment slot names this pet type can use. Uses string names instead of EquipmentSlot enum values for version compatibility, since SADDLE and BODY slots don't exist in older Bukkit versions.
      Returns:
      set of slot names (e.g., "HAND", "OFF_HAND", "HEAD", "CHEST", "LEGS", "FEET", "SADDLE", "BODY")
    • canUseSlot

      default boolean canUseSlot(EquipmentSlot slot)
      Checks if this pet type can use the given equipment slot.
      Parameters:
      slot - the equipment slot to check
      Returns:
      true if the pet can equip items in this slot
    • holdsAnyItem

      default boolean holdsAnyItem()
      Whether MyPet owns this pet's main hand outright: every item, gear or not, is equipped there by the sneak right-click, and the mob's own hand interaction (the allay's take-an-item / give-it-back on a plain right-click) and its item pickup are suppressed on pets.

      false (the default) keeps the gear-only rule: only items with an equipment slot or durability are equipped, and anything else falls through to vanilla. The allay is the one species whose vanilla hand holds any item, and letting vanilla fill it beside MyPet's own equipment store meant a sneak-equip silently overwrote a vanilla-held item while shears could not strip it.

      Returns:
      true if this pet's hand holds any item and vanilla never touches it
    • retainEquipmentOnTame

      default boolean retainEquipmentOnTame()
      When true (the default), a wild mob tamed with a lead keeps whatever armor and weapons it was wearing, and that gear becomes real MyPet equipment — readable through getEquipment(EquipmentSlot) and dropped by dropEquipment() on death and release. When false, the allowed slots are stripped at tame time and the items drop at the mob's location.

      Only the slots in getAllowedSlotNames() are affected, vanilla per-slot drop chances are ignored, and pets created by other plugins (source-driven adoptions) are not covered — the flag applies to leash taming only.

      Reads MyPet.Pets.<Type>.RetainEquipmentOnTame (default true), registered for every PetEquipment type in ConfigurationLoader.

      Returns:
      true if the mob keeps what it was wearing when tamed