From Minecraft Wiki
Jump to: navigation, search
Information icon.svg
This feature is exclusive to Java Edition.


First introduced

Java Edition 1.13 (Java Edition 17w45a)

This article is a stub, meaning that it lacks some important content.
You can help by expanding it with further information relating to the topic.
Reason: Add data modify explanation.

Allows the player to get, merge, and remove block entity and entity 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 modify block <pos> <path> (append|insert <index>|merge|prepend|set) from block <pos> <path>
data modify block <pos> <path> (append|insert <index>|merge|prepend|set) from entity <target> <path>
data modify block <pos> <path> (append|insert <index>|merge|prepend|set) value <nbt>
data modify entity <target> <path> (append|insert <index>|merge|prepend|set) from block <pos> <path>
data modify entity <target> <path> (append|insert <index>|merge|prepend|set) from entity <target> <path>
data modify entity <target> <path> (append|insert <index>|merge|prepend|set) value <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 — Return value depends on what arguments are specified.
No additional arguments
Sends the entire NBT data from the block at pos or one target entity to the executor with syntax highlighting, and returns 1.
Only path
Sends the subsection of the NBT data from the block at pos or one target entity to the executor without syntax highlighting. Return value depends on the type of the NBT element:
  • Retrieving a number will return that number.
  • Retrieving a string will return the length of the string.
  • Retrieving a list will return the number of elements in that list.
  • Retrieving a compound will return the number of tags that are direct children of that compound.
Both path and scale
Requires a numeric value to be at the end of the path. Returns that numeric value scaled by scale.
  • merge — Merges the block NBT data at pos or from the target entity with the specified nbt data. Returns 1 on success.
  • remove — Will remove NBT data at path from the block at pos or from one target entity. Removing player NBT data is not allowed. Returns 1 on success.


Java Edition
1.1317w45bAdded /data.
1.1418w43aAdded /data modify.