Package dev.twilite.game.facade
Class Inventory
java.lang.Object
dev.twilite.game.facade.Inventory
Inventory accessors backed by the client's inventory data and interface components.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconsume(int... ids) Consumes a food or potion item based on its available action (Eat/Drink).static booleancontains(int... ids) Checks if the inventory contains any of the specified items.static booleancontainsAll(int... ids) Checks if the inventory contains all of the specified items.static intcount(int... ids) Returns the total stack size of an item in the inventory.static booleanempty()Returns if the inventory is empty.static intReturns the number of empty slots in the inventory.static booleanfull()Returns if the inventory is full.item(int... ids) Returns an Optional containing the first matching item from the inventory.static ItemViewitems()Returns a lazy view over carried inventory items.static ItemViewitems(int componentId) Returns a lazy view over inventory items using a custom item component.
-
Constructor Details
-
Inventory
public Inventory()
-
-
Method Details
-
items
Returns a lazy view over carried inventory items. -
items
Returns a lazy view over inventory items using a custom item component.- Parameters:
componentId- packed interface component id fromInterfaceId
-
full
public static boolean full()Returns if the inventory is full. -
empty
public static boolean empty()Returns if the inventory is empty. -
emptySlots
public static int emptySlots()Returns the number of empty slots in the inventory. -
item
Returns an Optional containing the first matching item from the inventory.- Parameters:
ids- item ids, usually fromItemId
-
contains
public static boolean contains(int... ids) Checks if the inventory contains any of the specified items.- Parameters:
ids- item ids, usually fromItemId
-
containsAll
public static boolean containsAll(int... ids) Checks if the inventory contains all of the specified items.- Parameters:
ids- item ids, usually fromItemId- Returns:
trueif all items are present, otherwisefalse
-
count
public static int count(int... ids) Returns the total stack size of an item in the inventory.- Parameters:
ids- item ids, usually fromItemId
-
consume
public static void consume(int... ids) Consumes a food or potion item based on its available action (Eat/Drink).- Parameters:
ids- item ids, usually fromItemId
-