public class Inventory extends java.lang.Object implements IInventory
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<java.util.function.BiConsumer<IInventory,java.lang.Integer>> |
callbacks |
protected ItemInstance[] |
slots |
| Constructor and Description |
|---|
Inventory(int slotAmount) |
| Modifier and Type | Method and Description |
|---|---|
ItemInstance |
add(int id,
int amount) |
ItemInstance |
add(ItemInstance instance,
boolean simulate) |
void |
addChangeCallback(java.util.function.BiConsumer<IInventory,java.lang.Integer> callback) |
ItemInstance |
addExistingFirst(ItemInstance instance,
boolean simulate) |
ItemInstance |
addToSlot(int slot,
ItemInstance instance,
boolean simulate) |
ItemInstance |
get(int id) |
int |
getSlotAmount() |
void |
load(DataSet set) |
void |
notifyChange(int slot) |
ItemInstance |
remove(int id,
int amount) |
void |
removeChangeCallback(java.util.function.BiConsumer<IInventory,java.lang.Integer> callback) |
void |
save(DataSet set) |
void |
set(int id,
ItemInstance instance) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcontainsItem, containsResource, getItemIndexprotected final java.util.List<java.util.function.BiConsumer<IInventory,java.lang.Integer>> callbacks
protected final ItemInstance[] slots
public void set(int id,
ItemInstance instance)
set in interface IInventorypublic ItemInstance add(int id, int amount)
add in interface IInventorypublic ItemInstance remove(int id, int amount)
remove in interface IInventorypublic ItemInstance get(int id)
get in interface IInventorypublic int getSlotAmount()
getSlotAmount in interface IInventorypublic void notifyChange(int slot)
notifyChange in interface IInventorypublic void addChangeCallback(java.util.function.BiConsumer<IInventory,java.lang.Integer> callback)
addChangeCallback in interface IInventorypublic void removeChangeCallback(java.util.function.BiConsumer<IInventory,java.lang.Integer> callback)
removeChangeCallback in interface IInventorypublic ItemInstance add(ItemInstance instance, boolean simulate)
public ItemInstance addExistingFirst(ItemInstance instance, boolean simulate)
public ItemInstance addToSlot(int slot, ItemInstance instance, boolean simulate)
public void save(DataSet set)
public void load(DataSet set)