Class endstone::ItemStack¶
ClassList > endstone > ItemStack
Represents a stack of items.
#include <endstone/inventory/item_stack.h>
Public Functions¶
Type | Name |
---|---|
ItemStack (const std::string & type, const int amount=1) |
|
ItemStack (const ItemType & type, const int amount=1) |
|
ItemStack (const ItemStack & stack) |
|
virtual std::unique_ptr< ItemStack > | clone () const |
virtual int | getAmount () const Gets the amount of items in this stack. |
virtual std::unique_ptr< ItemMeta > | getItemMeta () const Gets a copy of this ItemStack 'sItemMeta . |
virtual int | getMaxStackSize () const Get the maximum stack size for this item. |
virtual const ItemType & | getType () const Gets the type of this item. |
virtual bool | hasItemMeta () const Checks to see if any metadata has been defined. |
virtual bool | isSimilar (const ItemStack & other) const Checks if the two stacks are equal, but does not consider stack size (amount). |
bool | operator!= (const ItemStack & other) const |
bool | operator== (const ItemStack & other) const |
virtual void | setAmount (const int amount) Sets the amount of items in this stack. |
virtual bool | setItemMeta (ItemMeta * meta) Set the ItemMeta of thisItemStack . |
virtual Result< void > | setType (const std::string & type) Sets the type of this item. |
virtual void | setType (const ItemType & type) Sets the type of this item. |
virtual | ~ItemStack () = default |
Public Static Functions¶
Type | Name |
---|---|
Result< ItemStack > | create (const ItemType & type, const int amount=1) |
Result< ItemStack > | create (const std::string & type, const int amount=1) |
Protected Functions¶
Type | Name |
---|---|
virtual bool | isEndstoneItemStack () const |
Public Functions Documentation¶
function ItemStack [⅓]¶
function ItemStack [⅔]¶
function ItemStack [3/3]¶
function clone¶
function getAmount¶
Gets the amount of items in this stack.
Returns:
Amount of items in this stack
function getItemMeta¶
Gets a copy of this ItemStack 'sItemMeta .
Returns:
a copy of the current ItemStack's ItemMeta
function getMaxStackSize¶
Get the maximum stack size for this item.
Returns:
The maximum you can stack this item to.
function getType¶
Gets the type of this item.
Returns:
Type of the items in this stack
function hasItemMeta¶
Checks to see if any metadata has been defined.
Returns:
Returns true if some metadata has been set for this item
function isSimilar¶
Checks if the two stacks are equal, but does not consider stack size (amount).
Parameters:
other
the item stack to compare to
Returns:
true if the two stacks are equal, ignoring the amount
function operator!=¶
function operator==¶
function setAmount¶
Sets the amount of items in this stack.
Parameters:
amount
New amount of items in this stack
function setItemMeta¶
Set the ItemMeta of thisItemStack .
Parameters:
meta
new ItemMeta, or null to indicate meta data be cleared.
Returns:
True if successfully applied ItemMeta
function setType [½]¶
Sets the type of this item.
Parameters:
type
New type to set the items in this stack to
function setType [2/2]¶
Sets the type of this item.
Parameters:
type
New type to set the items in this stack to
function ~ItemStack¶
Public Static Functions Documentation¶
function create [½]¶
static inline Result< ItemStack > endstone::ItemStack::create (
const ItemType & type,
const int amount=1
)
function create [2/2]¶
static inline Result< ItemStack > endstone::ItemStack::create (
const std::string & type,
const int amount=1
)
Protected Functions Documentation¶
function isEndstoneItemStack¶
Friends Documentation¶
friend EndstoneItemStack¶
The documentation for this class was generated from the following file include/endstone/inventory/item_stack.h