Skip to content

ItemStack

ItemStack represents an item with its properties, durability, and metadata.

propertytypedescription
typeStringitem class name
nameStringregistry name
displayNameStringdisplay name
stackSizeintcurrent stack size
maxStackSizeintmax stack size
durabilityintremaining durability
maxDurabilityintmax durability
isBlockbooleantrue if the item is a block
metaintitem metadata

constructor

Creates a new item stack from a registry name.

java
ItemStack stack = new ItemStack(String name);

getEnchantments

Returns a list of enchantments on the item.

java
List<Object[]> enchantments = stack.getEnchantments();

getTooltip

Returns the item's tooltip as a list of strings.

java
List<String> tooltip = stack.getTooltip();