> For the complete documentation index, see [llms.txt](https://scripting.breeze.rip/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://scripting.breeze.rip/newgen/api/net/minecraft/world/item/itemstack.md).

# ItemStack

A stack of items. An empty slot is an empty stack, never null.

### Properties

#### attackDamage

> `readonly` **attackDamage**: `number`

Melee damage when held in the main hand, in half hearts.

**Remarks**

The player's base damage of 1 plus the item's attribute modifiers. Enchantments, strength and charge are not included.

***

#### attackSpeed

> `readonly` **attackSpeed**: `number`

Attacks per second when held in the main hand.

**Remarks**

The player's base speed of 4 plus the item's attribute modifiers.

***

#### canAlwaysEat

> `readonly` **canAlwaysEat**: `boolean`

Whether it can be eaten with a full hunger bar.

***

#### cooldownPercent

> `readonly` **cooldownPercent**: `number`

How much of the local player's cooldown for this item is left, from 1 down to 0.

***

#### count

> `readonly` **count**: `number`

The number of items.

***

#### customName

> `readonly` **customName**: `string`

The name set with an anvil or command, without formatting.

**Remarks**

Null when the item has no custom name.

***

#### damageValue

> `readonly` **damageValue**: `number`

Durability used so far.

***

#### enchantments

> `readonly` **enchantments**: [`EnchantmentInstance`](/newgen/api/net/minecraft/world/item/enchantment/enchantmentinstance.md)\[]

Every enchantment on the item.

***

#### id

> `readonly` **id**: `string`

The item id, e.g. "minecraft:diamond\_sword".

**See**

[Item ids](https://minecraft.wiki/w/Java_Edition_data_values/Items)

***

#### isFood

> `readonly` **isFood**: `boolean`

Whether eating the item restores hunger.

***

#### isOnCooldown

> `readonly` **isOnCooldown**: `boolean`

Whether the local player cannot use this item yet, e.g. an ender pearl just thrown.

***

#### maxDamage

> `readonly` **maxDamage**: `number`

Total durability, 0 if it has none.

***

#### maxStackSize

> `readonly` **maxStackSize**: `number`

How many fit in one slot.

***

#### name

> `readonly` **name**: `string`

The display name, without formatting.

***

#### nutrition

> `readonly` **nutrition**: `number`

Hunger points restored by eating, 0 for non-food.

***

#### rarity

> `readonly` **rarity**: [`Rarity`](/newgen/api/enum_types/rarity.md)

The rarity, which colours the name. Enchanted items count one step higher.

***

#### remainingDurability

> `readonly` **remainingDurability**: `number`

Durability left, 0 if the item has none.

***

#### saturation

> `readonly` **saturation**: `number`

Saturation restored by eating, 0 for non-food.

***

#### tags

> `readonly` **tags**: `string`\[]

The item tags this item is in, e.g. "minecraft:swords".

**See**

[Item tags](https://minecraft.wiki/w/Item_tag_\(Java_Edition\))

***

#### useDuration

> `readonly` **useDuration**: `number`

How many ticks the item takes to use, e.g. 32 for food.

**Remarks**

0 outside a world.

### Methods

#### copy()

> **copy**(): `ItemStack`

A copy of this stack that changes independently.

**Returns**

`ItemStack`

***

#### getEnchantmentLevel()

> **getEnchantmentLevel**(`enchantmentId`): `number`

The level of an enchantment on this item, 0 if it has none.

**Parameters**

**enchantmentId**

`string`

The enchantment id, e.g. "minecraft:sharpness".

**Returns**

`number`

**See**

[Enchantment ids](https://minecraft.wiki/w/Java_Edition_data_values/Enchantments)

***

#### hasComponent()

> **hasComponent**(`componentId`): `boolean`

Whether the item carries a data component.

**Parameters**

**componentId**

`string`

The component id, e.g. "minecraft:food".

**Returns**

`boolean`

***

#### is()

> **is**(`idOrTag`): `boolean`

Whether this is the given item, or in the given item tag.

**Parameters**

**idOrTag**

`string`

An item id like "minecraft:stone", or a tag with a leading #, like "#minecraft:swords".

**Returns**

`boolean`

**Remarks**

Tag names are listed under the item tag ids.

**See**

[Item ids](https://minecraft.wiki/w/Java_Edition_data_values/Items)

***

#### isDamageableItem()

> **isDamageableItem**(): `boolean`

Whether this item has durability.

**Returns**

`boolean`

***

#### isDamaged()

> **isDamaged**(): `boolean`

Whether the item has lost any durability.

**Returns**

`boolean`

***

#### isEmpty()

> **isEmpty**(): `boolean`

Whether this is an empty slot.

**Returns**

`boolean`

***

#### isEnchanted()

> **isEnchanted**(): `boolean`

Whether the item has any enchantment.

**Returns**

`boolean`

***

#### isSameItem()

> **isSameItem**(`other`): `boolean`

Whether both stacks hold the same item, ignoring count and components.

**Parameters**

**other**

`ItemStack`

The other stack.

**Returns**

`boolean`

***

#### isSameItemSameComponents()

> **isSameItemSameComponents**(`other`): `boolean`

Whether both stacks hold the same item with the same components, ignoring count.

**Parameters**

**other**

`ItemStack`

The other stack.

**Returns**

`boolean`

***

#### isStackable()

> **isStackable**(): `boolean`

Whether more than one fits in a slot.

**Returns**

`boolean`
