ItemStack API

Item

An Item represents a Minecraft item stack with material, amount, name, lore, and NBT data.


Constructor

Item(material=None, amount=1, name=None, lore=None, custom_model_data=None, attributes=None, nbt=None)

Create an item.

sword = Item("DIAMOND_SWORD", name="§bFrostbrand", lore=["§7A blade of ice"])
blocks = Item(Material.STONE, amount=64)

Class Methods

drop

entity = await Item.drop(material, location, amount=1, **kwargs)

Drop an item entity at a location.

await Item.drop("DIAMOND", player.location, amount=5)

give

await Item.give(player, material, amount=1, **kwargs)

Give an item directly to a player's inventory.

await Item.give(player, "GOLDEN_APPLE", 3)

Attributes

type

The item's material type.

amount

Current stack size.

name

Display name, or None for the default name.

lore

Lore lines displayed below the item name.

custom_model_data

Custom model data value for resource packs.

attributes

Attribute modifiers (attack damage, armor, etc.).

nbt

The item's NBT data as a dictionary.

max_stack_size

Maximum stack size for this item type (e.g. 64 for blocks, 16 for ender pearls, 1 for tools).


Methods

set_amount

await item.set_amount(value)

Set the stack size.

set_name

await item.set_name(name)

Set the display name.

set_lore

await item.set_lore(lore)

Set the lore lines.

set_custom_model_data

await item.set_custom_model_data(value)

Set custom model data.

set_attributes

await item.set_attributes(attributes)

Set attribute modifiers.

set_nbt

await item.set_nbt(nbt)

Set raw NBT data.

clone

copy = await item.clone()

Create a deep copy of this item.

is_similar

result = await item.is_similar(other)

Check if two items are similar (same type, name, lore — ignoring amount).