GameplayJavaBedrock

/data

Reads and edits the raw NBT of a block entity, entity, or command storage. /data get queries a value (optionally scaled), /data merge shallow-merges a compound, /data modify performs targeted set/insert/append/prepend operations (including copying from another source), and /data remove deletes a path. This is the modern replacement for editing NBT through /entitydata and /blockdata.

Syntax

Alternate forms:

Parameters

action
literal
get / merge / modify / remove.
source kind
literal
block <x y z>, entity <selector>, or storage <id>.
pathoptional
NBT path
Dotted path into the compound, e.g. Health or Inventory[0].id.
nbtoptional
SNBT
Stringified NBT used by merge / modify ... value.

Examples

  • Print the executing player's full NBT to chat.

  • Read just your current health value.

  • Freeze the nearest villager by setting NoAI.

  • Copy your held item into the container below you.

Common questions

How do I see an entity's NBT in Minecraft?

Use /data get entity <target> with no path to dump everything, or add a path like /data get entity @e[type=zombie,limit=1] Health to read one value. Cheats must be enabled.

What replaced /entitydata and /blockdata?

/data merge and /data modify. /data merge entity <target> {…} replaces the old /entitydata, and /data merge block <x y z> {…} replaces /blockdata.

Permission level

/data requires Cheats (op level 2). In single-player you need the world's "Allow Cheats" toggle on. On a multiplayer server you need to be opped — see /op.