Interface Backpack

All Superinterfaces:
ActiveSkill, Skill

public interface Backpack extends Skill, ActiveSkill
Skill that grants the pet a portable inventory (backpack) which the owner can open to store and retrieve items. The number of available inventory rows scales with the pet's skilltree level. Activating the skill opens the backpack GUI for the owner.

This skill persists its inventory contents via a registered SkillStateCodec and supports an optional "drop on death" mechanic where all stored items are dropped when the pet dies.

See Also:
  • Method Details

    • getInventory

      CustomInventory getInventory()
      Returns a transient CustomInventory view of the current contents, sized to the current row capacity. Used by drop-on-death and self-feeding.
      Returns:
      the pet's backpack inventory
    • addItem

      int addItem(ItemStack item)
      Adds an item to the backpack and persists the result, unlike the transient getInventory() view. Returns the amount that did not fit (0 if fully stored).
      Parameters:
      item - the item to store
      Returns:
      how much of the stack did not fit
    • getDropOnDeath

      UpgradeComputer<Boolean> getDropOnDeath()
      Returns the upgrade computer controlling whether items drop when the pet dies.
      Returns:
      the upgrade computer for whether items drop when the pet dies
    • getRows

      Returns the upgrade computer controlling the number of inventory rows available.
      Returns:
      the upgrade computer for the number of inventory rows available