Package dev.twilite.game.facade
Class Equipment
java.lang.Object
dev.twilite.game.facade.Equipment
Provides queries and interactions for items currently worn by the local player.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanallWorn(int... ids) Checks if all of the specified items are equipped.static intcount(int id) Returns the total stack size of an equipped item (useful for ammo/arrows).item(int... ids) Returns an Optional containing the first equipped item matching any of the specified IDs.item(EquipmentSlot slot) Returns the item currently equipped in the specified slot.static ItemViewitems()Returns a lazy view over carried equipment items.static voidunequip(int... ids) Unequips all currently worn items matching any of the specified IDs.static voidunequip(EquipmentSlot... slots) Unequips the currently worn item in each specified slot.static booleanworn(int... ids) Checks if any of the specified items are currently equipped.
-
Constructor Details
-
Equipment
public Equipment()
-
-
Method Details
-
items
Returns a lazy view over carried equipment items. -
worn
public static boolean worn(int... ids) Checks if any of the specified items are currently equipped.- Parameters:
ids- item ids to check, usually fromItemId- Returns:
trueif at least one of the specified items is equipped, otherwisefalse
-
allWorn
public static boolean allWorn(int... ids) Checks if all of the specified items are equipped.- Parameters:
ids- item ids to check- Returns:
trueif all items are equipped, otherwisefalse
-
count
public static int count(int id) Returns the total stack size of an equipped item (useful for ammo/arrows).- Parameters:
id- item id to count, usually fromItemId- Returns:
- the total stack size of the matching equipped item
-
item
Returns an Optional containing the first equipped item matching any of the specified IDs.- Parameters:
ids- item ids to find, usually fromItemId- Returns:
- an Optional containing the first matching item if found, otherwise empty
-
item
Returns the item currently equipped in the specified slot.- Parameters:
slot- equipment slot to inspect- Returns:
- an Optional containing the equipped item if the slot is occupied
-
unequip
public static void unequip(int... ids) Unequips all currently worn items matching any of the specified IDs.- Parameters:
ids- item ids to unequip, usually fromItemId
-
unequip
Unequips the currently worn item in each specified slot.- Parameters:
slots- equipment slots to unequip
-