endstone::ItemStack
Represents a stack of items.
Functions:
Name | Description |
---|---|
ItemStack | |
ItemStack | |
clone | |
getAmount | Gets the amount of items in this stack. |
getData | Gets the data for this stack of items. |
getItemMeta | Gets a copy of this ItemStack ‘s ItemMeta . |
getMaxStackSize | Get the maximum stack size for this item. |
getType | Gets the type of this item. |
hasItemMeta | Checks to see if any metadata has been defined. |
isSimilar | Checks if the two stacks are equal, but does not consider stack size (amount). |
setAmount | Sets the amount of items in this stack. |
setData | Sets the data for this stack of items. |
setItemMeta | Set the ItemMeta of this ItemStack . |
setType | Sets the type of this item. |
ItemStack
ItemStack(const std::string &type = "minecraft:air", const int amount = 1,
const int data = 0)
ItemStack(const ItemStack &stack)
clone
std::unique_ptr<ItemStack> clone() const
getAmount
int getAmount() const
Gets the amount of items in this stack.
Returns:
Amount of items in this stack
getData
int getData() const
Gets the data for this stack of items.
Returns:
Data for this item
getItemMeta
std::unique_ptr<ItemMeta> getItemMeta() const
Gets a copy of this ItemStack ‘s ItemMeta .
Returns:
a copy of the current ItemStack’s ItemMeta
getMaxStackSize
int getMaxStackSize() const
Get the maximum stack size for this item.
Returns:
The maximum you can stack this item to.
getType
std::string getType() const
Gets the type of this item.
Returns:
Type of the items in this stack
hasItemMeta
bool hasItemMeta() const
Checks to see if any metadata has been defined.
Returns:
Returns true if some metadata has been set for this item
isSimilar
bool isSimilar(const ItemStack &other) const
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
setAmount
void setAmount(const int amount)
Sets the amount of items in this stack.
Parameters:
amount
New amount of items in this stack
setData
void setData(const int data)
Sets the data for this stack of items.
Parameters:
data
New data for this item
setItemMeta
bool setItemMeta(ItemMeta *meta)
Set the ItemMeta of this ItemStack .
Parameters:
meta
new ItemMeta, or null to indicate meta data be cleared.
Returns:
True if successfully applied ItemMeta
setType
void setType(const std::string &type)
Sets the type of this item.
Parameters:
type
New type to set the items in this stack to