Class endstone::ItemStack¶
ClassList > endstone > ItemStack
Represents a stack of items.
#include <endstone/inventory/item_stack.h>
Public Functions¶
| Type | Name |
|---|---|
| ItemStack (ItemId type, const int amount=1, const int data=0) |
|
| ItemStack (const ItemStack & stack) |
|
| virtual std::unique_ptr< ItemStack > | clone () const |
| virtual int | getAmount () const Gets the amount of items in this stack. |
| virtual int | getData () const Gets the data for this stack of items. |
| 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 std::string | getTranslationKey () const Get the translation key, suitable for use in a translation component. |
| virtual ItemId | 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 Result< void > | setAmount (const int amount) Sets the amount of items in this stack. |
| virtual void | setData (const int data) Sets the data for this stack of items. |
| virtual bool | setItemMeta (ItemMeta * meta) Set the ItemMeta of thisItemStack . |
| virtual Result< void > | setType (ItemId type) Sets the type of this item. |
| virtual CompoundTag | toNbt () const Serializes this ItemStack into a Named Binary Tag (NBT) |
| virtual | ~ItemStack () = default |
Public Static Functions¶
| Type | Name |
|---|---|
| std::unique_ptr< ItemStack > | fromNbt (const CompoundTag & tag) Deserializes an ItemStack from a Named Binary Tag (NBT). |
Protected Functions¶
| Type | Name |
|---|---|
| virtual bool | isEndstoneItemStack () const |
Public Functions Documentation¶
function ItemStack [⅔]¶
inline explicit endstone::ItemStack::ItemStack (
ItemId type,
const int amount=1,
const int data=0
)
function ItemStack [3/3]¶
function clone¶
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 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 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 setType¶
Sets the type of this item.
Parameters:
typeNew type to set the items in this stack to
function toNbt¶
Serializes this ItemStack into a Named Binary Tag (NBT)
Returns:
A CompoundTag containing the NBT of this ItemStack.
function ~ItemStack¶
Public Static Functions Documentation¶
function fromNbt¶
Deserializes an ItemStack from a Named Binary Tag (NBT).
Parameters:
tagThe CompoundTag used to deserialize the ItemStack.
Returns:
The ItemStack created from the provided NBT.
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