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() constGets the amount of items in this stack.
Returns:
Amount of items in this stack
getData
int getData() constGets the data for this stack of items.
Returns:
Data for this item
getItemMeta
std::unique_ptr<ItemMeta> getItemMeta() constGets a copy of this ItemStack ‘s ItemMeta .
Returns:
a copy of the current ItemStack’s ItemMeta
getMaxStackSize
int getMaxStackSize() constGet the maximum stack size for this item.
Returns:
The maximum you can stack this item to.
getType
std::string getType() constGets the type of this item.
Returns:
Type of the items in this stack
hasItemMeta
bool hasItemMeta() constChecks 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) constChecks if the two stacks are equal, but does not consider stack size (amount).
Parameters:
otherthe 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:
amountNew amount of items in this stack
setData
void setData(const int data)Sets the data for this stack of items.
Parameters:
dataNew data for this item
setItemMeta
bool setItemMeta(ItemMeta *meta)Set the ItemMeta of this ItemStack .
Parameters:
metanew 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:
typeNew type to set the items in this stack to