/data
Gets, merges, modifies, or removes NBT data from entities, block entities, or storage. A powerful command for advanced data manipulation.
Syntax
/data <get|merge|modify|remove> <target> <path> [<value>]Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| action | literal | Required | get, merge, modify, or remove. |
| target | data_target | Required | The target: entity <selector>, block <pos>, or storage <id>. |
| path | nbt_path | Optional | The NBT path to operate on. |
| value | nbt | Optional | The NBT value to set or merge. |
Examples
/data get entity @s InventoryDisplays your full inventory as NBT data.
/data merge entity @e[type=villager,limit=1,sort=nearest] {Invulnerable:1b}Makes the nearest villager invulnerable.
/data modify storage my_namespace:my_data scores append value 100Appends the value 100 to the 'scores' list in a custom data storage.
Common Mistakes
- Trying to modify player data directly, many player NBT fields are read-only via /data.
- Incorrect NBT path syntax, paths use dot notation for objects and square brackets for lists.
Notes
The 'storage' target type provides persistent key-value storage in the world data. Player entities have restrictions on which NBT fields can be written. Block entity data can be read and modified for things like signs, chests, and command blocks.
Related Commands
Need a Minecraft server?
Try these commands on Astroworld or host your own server.
Try Astroworld Hosting