Package de.Keyle.MyPet.api.skill.skills
Interface Backpack
- All Superinterfaces:
ActiveSkill,Skill
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:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordSnapshot of a Backpack skill's persisted or live contents as a raw item array. -
Method Summary
Modifier and TypeMethodDescriptionintAdds an item to the backpack and persists the result, unlike the transientgetInventory()view.Returns the upgrade computer controlling whether items drop when the pet dies.Returns a transientCustomInventoryview of the current contents, sized to the current row capacity.getRows()Returns the upgrade computer controlling the number of inventory rows available.Methods inherited from interface de.Keyle.MyPet.api.skill.ActiveSkill
activateMethods inherited from interface de.Keyle.MyPet.api.skill.skilltree.Skill
applyState, getName, getName, getPet, getState, getUpgradeMessage, isActive, reset, toPrettyComponent
-
Method Details
-
getInventory
CustomInventory getInventory()Returns a transientCustomInventoryview 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
Adds an item to the backpack and persists the result, unlike the transientgetInventory()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
UpgradeComputer<Number> getRows()Returns the upgrade computer controlling the number of inventory rows available.- Returns:
- the upgrade computer for the number of inventory rows available
-