Class endstone::ItemStack¶
ClassList > endstone > ItemStack
Represents a stack of items.
#include <endstone/inventory/item_stack.h>
Public Functions¶
| Type | Name |
|---|---|
| ItemStack (ItemTypeId type, int amount=1, int data=0) An item stack. |
|
| ItemStack (const ItemStack & other) |
|
| ItemStack (ItemStack && other) noexcept |
|
| int | getAmount () const Gets the amount of items in this stack. |
| int | getData () const Gets the data for this stack of items. |
| std::unique_ptr< ItemMeta > | getItemMeta () const Gets a copy of this ItemStack 'sItemMeta . |
| int | getMaxStackSize () const Get the maximum stack size for this item. |
| CompoundTag | getNbt () const Gets the NBT compound tag of this item stack. |
| std::string | getTranslationKey () const Get the translation key, suitable for use in a translation component. |
| const ItemType & | getType () const Gets the type of this item. |
| bool | hasItemMeta () const Checks to see if any metadata has been defined. |
| 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 |
| ItemStack & | operator= (const ItemStack & other) |
| ItemStack & | operator= (ItemStack && other) noexcept |
| bool | operator== (const ItemStack & other) const |
| void | setAmount (int amount) Sets the amount of items in this stack. |
| void | setData (int data) Sets the data for this stack of items. |
| bool | setItemMeta (ItemMeta * meta) Set the ItemMeta of thisItemStack . |
| void | setNbt (const CompoundTag & nbt) Sets the NBT compound tag of this item stack. |
| void | setType (ItemTypeId type) Sets the type of this item. |
| ~ItemStack () = default |
Public Functions Documentation¶
function ItemStack [¼]¶
An item stack.
Parameters:
typethe typeamountthe amount in the stackdatathe data value
function ItemStack [2/4]¶
function ItemStack [¾]¶
function getAmount¶
Gets the amount of items in this stack.
Returns:
Amount of items in this stack
function getData¶
Gets the data for this stack of items.
Returns:
Data for this item
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 getNbt¶
Gets the NBT compound tag of this item stack.
Returns:
the NBT compound tag
function getTranslationKey¶
Get the translation key, suitable for use in a translation component.
Returns:
the translation key
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:
otherthe item stack to compare to
Returns:
true if the two stacks are equal, ignoring the amount
function operator!=¶
function operator=¶
function operator=¶
function operator==¶
function setAmount¶
Sets the amount of items in this stack.
Parameters:
amountNew amount of items in this stack
function setData¶
Sets the data for this stack of items.
Parameters:
dataNew data for this item
function setItemMeta¶
Set the ItemMeta of thisItemStack .
Parameters:
metanew ItemMeta, or null to indicate meta data be cleared.
Returns:
True if successfully applied ItemMeta
function setNbt¶
Sets the NBT compound tag of this item stack.
Parameters:
nbtthe NBT compound tag to set
function setType¶
Sets the type of this item.
Parameters:
typeNew type to set the items in this stack to
function ~ItemStack¶
Friends Documentation¶
friend EndstoneItemStack¶
The documentation for this class was generated from the following file include/endstone/inventory/item_stack.h