ItemStack
A proxy for an item stack from Minecraft
This page is a WIP. It contains all the information in Figura's documentation but we're working on adding more helpful descriptions.
For all exmaples on this page assume:
local item = player:getHeldItem()
General
getCount()
Gets the number of items in this stack
getCount()
Returns:
Type | Description |
---|---|
Integer | - |
Example:
item:getCount()
getID()
Gets the ID of this stack
getID()
Returns:
Type | Description |
---|---|
String | - |
Example:
item:getID()
getMaxCount()
Gets the maximum stack size of this item
getMaxCount()
Returns:
Type | Description |
---|---|
Integer | - |
Example:
item:getMaxCount()
getName()
Gets the name of the item
getName()
Returns:
Type | Description |
---|---|
String | - |
Example:
item:getName()
getPopTime()
Gets the item's animation bobbing time, in ticks. This value is used to move an item to the player when it is picked up
getPopTime()
Returns:
Type | Description |
---|---|
Integer | - |
Example:
item:getPopTime()
getRarity()
Gets the rarity of this item stack
COMMON = white, UNCOMMON = yellow, RARE = aqua, EPIC = light purple
getRarity()
Returns:
Type | Description |
---|---|
String | - |
Example:
item:getRarity()
getTag()
Gets a table of the NBT tags of this stack
getTag()
Returns:
Type | Description |
---|---|
Table | - |
Example:
item:getTag()
getTags()
Gets all the tags of this item as strings in a table
getTags()
Returns:
Type | Description |
---|---|
Table | - |
Example:
item:getTags()
getUseAction()
Returns the name of the animation that plays when using this item
getUseAction()
Returns:
Type | Description |
---|---|
String | - |
Example:
item:getUseAction()
getUseDuration()
Gets the number of ticks needed to "use" this item
Currently only has a use for food items
Always 32 for food items except kelp, which is 16
getUseDuration()
Returns:
Type | Description |
---|---|
Integer | - |
Example:
item:getUseDuration()
copy()
Returns a copy of this item stack
copy()
Returns:
Type | Description |
---|---|
ItemStack | Returns self for chaining |
Example:
item:copy()
hasGlint()
Returns true if this item glows with enchantment glint
hasGlint()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
item:hasGlint()
isFood()
Returns true if this item is edible
isFood()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
item:isFood()
isStackable()
Returns true if the item is stackable
isStackable()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
item:isStackable()
toStackString()
Converts this ItemStack to a string, as you'd see in a command
toStackString()
Returns:
Type | Description |
---|---|
String | - |
Example:
item:toStackString()
Equipment/Tools
getDamage()
Gets the damage value of the item in this stack
Works on things like tools, or other things with a durability bar
getDamage()
Returns:
Type | Description |
---|---|
Integer | - |
Example:
item:getDamage()
getEquipmentSlot()
Returns the slot name of where this item is used
getEquipmentSlot()
Returns:
Type | Description |
---|---|
String | - |
Example:
item:getEquipmentSlot()
getMaxDamage()
Gets the maximum durability of this item stack
getMaxDamage()
Returns:
Type | Description |
---|---|
Integer | - |
Example:
item:getMaxDamage()
getRepairCost()
Gets the repair cost modifier, in an anvil, for this item stack
getRepairCost()
Returns:
Type | Description |
---|---|
Integer | - |
Example:
item:getRepairCost()
isArmor()
Checks if this item is Armor
isArmor()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
item:isArmor()
isDamageable()
Returns true if this item stack has durability
isDamageable()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
item:isDamageable()
isEnchantable()
Returns true if this item stack can be put in an enchanting table
isEnchantable()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
item:isEnchantable()
isTool()
Check if this item is a Tool (Axe, Shovel, Pickaxe, …)
isTool()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
item:isTool()
Block Items
getBlockstate()
Returns the blockstate representation of this item stack
If this item has no block representation, returns nil
getBlockstate()
Returns:
Type | Description |
---|---|
BlockState | - |
Example:
item:getBlockstate()
isBlockItem()
Returns true if this item represents a block
isBlockItem()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
item:isBlockItem()
Fields
id
Contains the id of the item this ItemStack refers to
Example:
item.id
tag
A table containing the NBT tag of this ItemStack
If this ItemStack has nothing in its tag, it is nil
Example:
item.tag