Package dev.twilite.game.loadout
Class InventoryLoadout
java.lang.Object
dev.twilite.game.loadout.InventoryLoadout
- All Implemented Interfaces:
Iterable<LoadoutItem>
Item-id based inventory loadout.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(int id) Adds a required item by id with an amount of 1.add(LoadoutItem item) Adds an item entry.static InventoryLoadoutcreate()Creates an empty inventory loadout.Returns the item depletion listener.depletionListener(ItemDepletionListener depletionListener) Sets the item depletion listener.booleanempty()Returns whether no entries have been added.excess()Returns entries carried above their requested amount.foreign()Returns carried inventory items that are not part of this loadout.booleanReturns whether all required entries are currently carried.booleanfulfilled(boolean allowForeign) Returns whether all required entries are currently carried.items()Returns the entries in insertion order.iterator()missing()Returns missing required entries.intReturns the requested inventory slots.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
InventoryLoadout
public InventoryLoadout()
-
-
Method Details
-
create
Creates an empty inventory loadout. -
add
Adds an item entry. -
add
Adds a required item by id with an amount of 1. -
missing
Returns missing required entries. -
excess
Returns entries carried above their requested amount. -
foreign
Returns carried inventory items that are not part of this loadout. -
fulfilled
public boolean fulfilled()Returns whether all required entries are currently carried. -
fulfilled
public boolean fulfilled(boolean allowForeign) Returns whether all required entries are currently carried.- Parameters:
allowForeign- if foreign items are allowed in the loadout
-
usedSlots
public int usedSlots()Returns the requested inventory slots. -
empty
public boolean empty()Returns whether no entries have been added. -
items
Returns the entries in insertion order. -
depletionListener
Returns the item depletion listener. -
depletionListener
Sets the item depletion listener. -
iterator
- Specified by:
iteratorin interfaceIterable<LoadoutItem>
-