/

/data

op 2Scoreboard

/data is how you inspect and edit NBT in a running world. get reads a path, merge overlays a compound, modify changes one path precisely, and remove deletes it. Paths use dots for compounds and square brackets for lists — Inventory[0].id is the first inventory slot’s item id.

Commandready
19
/data get entity @e
Press C to copy
All entities
@e

Who or what the command applies to

optional
optional

Examples

  • Read held item
    /data get entity @s SelectedItem
  • Rename a sign
    /data merge block ~ ~ ~ {front_text:{messages:['{"text":"Hi"}']}}

Common questions about /data

How do I read what a player is holding?

/data get entity @s SelectedItem returns the whole held stack. Add .id to the path for just the item id.

Why does /data merge wipe part of my data?

merge replaces whole lists rather than combining them. To add one element, use /data modify … append instead.

What is data storage for?

It is world-level NBT not attached to any entity or block, which makes it the natural place for a data pack to keep its own state.