public interface Inventory extends Clearable
Modifier and Type | Method and Description |
---|---|
boolean |
canPlayerUse(PlayerEntity player) |
default boolean |
containsAny(Set<Item> items)
Determines whether this inventory contains any of the given candidate items.
|
default int |
count(Item item)
Returns the number of times the specified item occurs in this inventory across all stored stacks.
|
default int |
getMaxCountPerStack()
Returns the maximum number of items a stack can contain when placed inside this inventory.
|
ItemStack |
getStack(int slot)
Fetches the stack currently stored at the given slot.
|
boolean |
isEmpty() |
default boolean |
isValid(int slot,
ItemStack stack)
Returns whether the given stack is a valid for the indicated slot position.
|
void |
markDirty() |
default void |
onClose(PlayerEntity player) |
default void |
onOpen(PlayerEntity player) |
ItemStack |
removeStack(int slot)
Removes the stack currently stored at the indicated slot.
|
ItemStack |
removeStack(int slot,
int amount)
Removes a specific number of items from the given slot.
|
void |
setStack(int slot,
ItemStack stack) |
int |
size() |
int size()
boolean isEmpty()
ItemStack getStack(int slot)
ItemStack.EMPTY
.ItemStack removeStack(int slot, int amount)
ItemStack removeStack(int slot)
void setStack(int slot, ItemStack stack)
default int getMaxCountPerStack()
count
of item stacks in this inventoryvoid markDirty()
boolean canPlayerUse(PlayerEntity player)
default void onOpen(PlayerEntity player)
default void onClose(PlayerEntity player)
default boolean isValid(int slot, ItemStack stack)
default int count(Item item)