From Minecraft Wiki
Jump to: navigation, search


First introduced

1.13 (17w45a)

Allows the player to get, merge, and remove entity and block NBT data.

data get block <pos> [<path>] [<scale>]
data get entity <target> [<path>] [<scale>]
data merge block <pos> <nbt>
data merge entity <target> <nbt>
data remove block <pos> <path>
data remove entity <target> <path>
Specifies the position of the block.
Specifies the target entity.
path (Optional)
Specifies the path to the targeted NBT.
Data paths look like this:[0]."A [crazy name]".baz.
  • means foo's child called bar.
  • foo[0] means element 0 of foo.
  • "quoted strings" may be used if a name of a key needs to be escaped.
scale (Optional)
Scales the number retrieved from get.
Specifies the NBT tag to be merged/removed.
Fails if the arguments are not specified correctly.
On success:
  • get — Returns the NBT data from the block at pos or one target entity as its result (if a path is specified). A path can be specified to only retrieve that NBT data, but this is limited to numeric tags. An optional scale can be provided to scale the number retrieved.
  • merge — Merges the block NBT data at pos or from the target entity with the specified nbt data.
  • remove — Will remove NBT data at path from the block at pos or from one target entity. Removing player NBT data is not allowed.