Class endstone::Inventory¶
ClassList > endstone > Inventory
Interface to the various inventories.
#include <endstone/inventory/inventory.h>
Inherited by the following classes: endstone::PlayerInventory
Public Functions¶
Type | Name |
---|---|
virtual void | addItem (ItemStack & item) = 0 Stores the given ItemStacks in the inventory. This will try to fill existing stacks and empty slots as well as it can. |
virtual void | clear () = 0 Clears out the whole Inventory . |
virtual int | first (ItemStack & item) = 0 Returns the first slot in the inventory containing an ItemStack with the given stack. |
virtual std::vector< std::shared_ptr< ItemStack > > | getContents () const = 0 Returns all ItemStacks from the inventory. |
virtual std::shared_ptr< ItemStack > | getItem (int index) const = 0 Returns the ItemStack found in the slot at the given index. |
virtual int | getMaxStackSize () const = 0 Returns the maximum stack size for an ItemStack in this inventory. |
virtual int | getSize () const = 0 Returns the size of the inventory. |
virtual bool | isEmpty () const = 0 Check whether this inventory is empty. An inventory is considered to be empty if there are no ItemStacks in any slot of this inventory. |
virtual void | setItem (int index, std::shared_ptr< ItemStack > item) = 0 Stores the ItemStack at the given index of the inventory. |
virtual | ~Inventory () = default |
Public Functions Documentation¶
function addItem¶
Stores the given ItemStacks in the inventory. This will try to fill existing stacks and empty slots as well as it can.
Parameters:
item
The ItemStack to add
function clear¶
function first¶
Returns the first slot in the inventory containing an ItemStack with the given stack.
Parameters:
item
The ItemStack to match against
Returns:
The slot index of the given ItemStack or -1 if not found
function getContents¶
Returns all ItemStacks from the inventory.
Returns:
An array of ItemStacks from the inventory. Individual items may be null.
function getItem¶
Returns the ItemStack found in the slot at the given index.
Parameters:
index
The index of the Slot's ItemStack to return
Returns:
The ItemStack in the slot
function getMaxStackSize¶
Returns the maximum stack size for an ItemStack in this inventory.
Returns:
The maximum size for an ItemStack in this inventory.
function getSize¶
Returns the size of the inventory.
Returns:
The size of the inventory
function isEmpty¶
Check whether this inventory is empty. An inventory is considered to be empty if there are no ItemStacks in any slot of this inventory.
Returns:
true if empty, false otherwise
function setItem¶
Stores the ItemStack at the given index of the inventory.
Parameters:
function ~Inventory¶
The documentation for this class was generated from the following file include/endstone/inventory/inventory.h