Minecraft Wiki
Advertisement
Information icon
This feature is exclusive to Java Edition. 
Crafting Table
This article describes content that may be included in a future update. 
This content has appeared in development versions, but the full update containing it has not been released yet.

Commands/infobox

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

Syntax
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>
Arguments
pos
Specifies the position of the block.
target
Specifies the target entity.
path (Optional)
Specifies the path to the targeted NBT.
Data paths look like this: foo.bar[0]."A [crazy name]".baz.
  • foo.bar 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.
nbt
Specifies the NBT tag to be merged/removed.
Result
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.


Advertisement