Updated:
What changed
Up to 1.20.4, extra item data went in one {...} NBT block. From 1.20.5, name, enchantments, durability and so on are separate components written in [...] right after the item ID.
| Up to 1.20.4 (NBT) | 1.20.5+ (components) | |
|---|---|---|
| Where | { } after the ID | [ ] right after the ID |
| Separator | : | = |
| Enchantments | Enchantments:[{id:"sharpness",lvl:5}] | enchantments={sharpness:5} (1.21.5+) |
| Unbreakable | Unbreakable:1b | unbreakable={} |
| Name | display:{Name:'...'} | custom_name=... |
The same /give in both formats
# Up to 1.20.4
/give @p diamond_sword{Enchantments:[{id:"sharpness",lvl:5}],Unbreakable:1b} 1
# 1.21.5+
/give @p diamond_sword[enchantments={sharpness:5},unbreakable={}] 1
Between 1.20.5 and 1.21.4 there are more differences, such as enchantments={levels:{sharpness:5}}. Rather than track them by hand, choose your version in the give command generator.
Why components are better
- Each field has its own name, so it is clearer what a value does.
- New changes are possible, such as making any item edible or changing its max stack size.
- /clear and /execute use the same names when matching items.
Entities and blocks still use NBT
Only items moved to components. Mob data in /summon (such as {NoAI:1b}) and block data such as chest contents are still NBT. Items held by a mob inside that NBT use the component form.
/summon zombie ~ ~ ~ {NoAI:1b}
See how an item is stored
/data get entity @s SelectedItem
On Java this shows the ID and components of the item in your hand, a useful model for writing /give.
Bedrock Edition
This change only affects Java. Bedrock /give takes an amount, a data value and a small JSON block for a few fields such as can_destroy.
Common questions
- Do items in old worlds disappear? No. Opening a world in a new version converts item NBT to components. Only the way you write commands changes.
- Do data packs need rewriting? Parts that use item NBT (give, clear, item, item conditions) do. Parts that only use entity NBT usually still work.
- Where is the list of components? Press Tab while typing to see suggestions. The main ones are fields in the give generator.
Check your command
The Command Error Doctor checks common syntax mistakes in your browser.