Item Stack (Data Type)
An Object that describes a new item stack.
note
On 1.21.1, id and count, the names Apace and vanilla use, are accepted as aliases of item and amount. The same aliases work in Positioned Item Stack.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
item | Identifier | required | The ID of a registered item. id is accepted as an alias. |
amount | Integer | 1 | The size of the stack. count is accepted as an alias. |
tag | NBT | optional | 1.20.1 only. NBT data of the item, such as enchantments, Damage or a custom name. |
components | Object | optional | 1.21.1 only. Vanilla DataComponentPatch JSON, the 1.21.1 equivalent of tag. |
Version differences (1.20.1 and 1.21.1)
Minecraft 1.21.1 keeps item data in data components instead of NBT, and this data type follows: 1.20.1 packs use the tag field with NBT, and 1.21.1 packs use the components field with vanilla's component patch JSON. The two shapes are very different ({Damage: 5} becomes {"minecraft:damage": 5}), so there is no clean way to unify them. The basic case, {"item": "..."} with no extra data, works the same on both versions.
Examples
"stack": {
"item": "minecraft:coal",
"amount": 24
}A stack of 24 coal.
"stack": {
"item": "minecraft:golden_helmet",
"tag": "{Enchantments: [{id: \"minecraft:projectile_protection\", lvl: 2s}]}"
}A golden helmet with Projectile Protection II.