How to Use the Data Command in Minecraft
This Minecraft tutorial explains how to use the /data command with screenshots and step-by-step instructions.
You can use the /data command to get, merge and remove NBT tags (formerly called data tags) for entities and block entities. The /data command is most useful for changing attributes of a mob after the mob has spawned or modifying attributes of a block entity after you have placed it.
Let’s explore how to use this cheat (game command).
Supported Platforms
The /data command is available in the following versions of Minecraft:
| Platform | Supported (Version*) |
|---|---|
Java Edition (PC/Mac) | Yes (1.13) |
Pocket Edition (PE) | No |
Xbox 360 | No |
Xbox One | No |
PS3 | No |
PS4 | No |
Wii U | No |
Nintendo Switch | No |
Windows 10 Edition | No |
Education Edition | No |
* The version that it was added or removed, if applicable.
NOTE: Pocket Edition (PE), Xbox One, PS4, Nintendo Switch, and Windows 10 Edition are now called Bedrock Edition. We will continue to show them individually for version history.
Requirements
To run game commands in Minecraft, you have to turn cheats on in your world.
Data Command
Data Command in Minecraft Java Edition (PC/Mac)
In Minecraft Java Edition (PC/Mac), there are different syntaxes depending on what you would like to do with the NBT tag (formerly called data tag).
To get the NBT tag for a block entity:
To get the NBT tag for an entity:
To merge the NBT tags for a block entity:
To merge the NBT tags for an entity:
To remove the NBT tags at path for a block entity:
To remove the NBT tags at path for an entity:
Definitions
Examples
Example in Java Edition (PC/Mac)
To change the name of one cow to Duke in Minecraft Java Edition (PC/Mac):
To get all NBT tag information for one player that is in Creative mode:
To get all NBT tag information for a chest at coordinates (329, 68, 91):
How to Enter the Command
1. Open the Chat Window
The easiest way to run a command in Minecraft is within the chat window. The game control to open the chat window depends on the version of Minecraft:
2. Type the Command
In this example, we are going to retrieve all of the NBT information for a block entity such as a chest.
To get the NBT tags for a chest at the coordinates (329, 68, 91), we would type the following command in Minecraft Java Edition (PC/Mac) 1.13:
Type the command in the chat window. As you are typing, you will see the command appear in the lower left corner of the game window. Press the Enter key to run the command.
Once the cheat has been entered, all of the NBT tags will be listed in the lower left corner of the game window.
In this example, the /data command returns the following NBT tags for the chest at 329, 68, 91:
Now we can see the x y z coordinates of the chest, all of the items inside the chest (ie: diamond sword, iron helmet, iron chestplate, iron leggings and iron boots) and the lock information for the chest.
Congratulations, you have learned how to use the /data command in Minecraft.
Other Game Commands
You can use other commands and cheats in Minecraft such as:
Using nbt paths in minecraft. 1.14 (/data modify|get)
Tutorial:How to use paths properly
-this tutorial is for the
part of the syntax of the «new» /data command
-this is a pretty advanced tutorial about json and nbt tags and you might want to do some research about that first
-key/value: if you don’t know at all about nbt tags in minecraft, try typing /data get entity @s, you should get something like
these are the nbt tags of the player, (or it’ data), it’s composed of keys and values, basically, keys are before «:» and values are after it.
-a key:value set : i will call that a set or a tag during this tutorial
— keys are always strings
-the root object is the object in which everything is stored, the < >we see around the data
— < >and [ ] will be used instead of <> and [] for clarity but remember to remove the spacing in actual code
the basics of the paths
in minecraft, path refers to a modified version of JSONpath, a syntax used to search values in json objects.
Let’s create an example minecraft object for this tutorial:
finding values in arrays or lists :
for this, another example is used: values:[
sand
gravel
stone
grass
.
sponge
]
| value | sand | gravel | stone | grass | sponge |
| positive index | 0 | 1 | 2 | 3 | 4 |
| negative index | -5 | -4 | -3 | -2 | -1 |
r ecursive research : indexes are always integers, except when they aren’t
Commands/data
The /data command allows the user to get, merge, modify, and remove NBT data of a block entity, entity, or Command NBT storage.
Contents
Syntax [ ]
Removes NBT data at
from the targeted block position or entity. Player NBT data cannot be removed.
Syntax displayed in various ways
| Maximised: | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| data get block [ ] [ ] data merge block data merge entity data merge storage data modify block append from block data modify block append from entity data modify block append from storage data modify block append value data modify block insert index> from block data modify block insert from entity data modify block insert from storage data modify block insert value data modify block merge from block data modify block merge from entity data modify block merge from storage data modify block merge value data modify block prepend from block data modify block prepend from entity data modify block prepend from storage data modify block prepend value data modify block set from block data modify block set from entity data modify block set from storage data modify block set value data modify entity append from block data modify entity append from entity data modify entity append from storage data modify entity append value data modify entity insert from block data modify entity insert from entity data modify entity insert from storage data modify entity insert value data modify entity merge from block data modify entity merge from entity data modify entity merge from storage data modify entity merge value data modify entity prepend from block data modify entity prepend from entity data modify entity prepend from storage data modify entity prepend value data modify entity set from block data modify entity set from entity data modify entity set from storage data modify entity set value data modify storage append from block data modify storage append from entity data modify storage append from storage data modify storage append value data modify storage insert from block data modify storage insert from entity data modify storage insert from storage data modify storage insert value data modify storage merge from block data modify storage merge from entity data modify storage merge from storage data modify storage merge value data modify storage prepend from block data modify storage prepend from entity data modify storage prepend from storage data modify storage prepend value data modify storage set from block data modify storage set from entity data modify storage set from storage data modify storage set value data remove block data remove entity data remove storage Arguments [ ]Specifies an entity whose NBT is to be operated on. Must be a player name, a target selector or a UUID. And the target selector must be of single type. Specifies a storage to be operated on. Must be a resource location. Specifies the NBT to retrieve or remove. Must be an NBT path. Scalar for the command’s return value. Must be a Double-precision floating-point format number. Specifies a compound tag to be merged into somewhere. Must be a compound NBT in SNBT format. Specifies target NBT to modify. Must be an NBT path. Specifies an item’s index within a list. Must be a 32-bit integer number. Value used in modifying the target NBT. Should match its data type. Must be an NBT tag of any type in SNBT format. Result [ ]Output [ ]Examples [ ]Storage [ ]The command storage of NBT data is an efficient way for commands to access or save NBT data without an overhead for block entities or entities reading from or writing to the NBT data. Each command storage is a general purpose, key-value storage, identified by a resource location to prevent unintentional conflicts. The command storage is accessible with JSON text as well. NBT Tags for Player in Minecraft (Java Edition 1.16)This Minecraft tutorial explains the NBT tags (formerly called data tags) that you can use for a player in Minecraft Java Edition (PC/Mac) 1.16. TIP: If you are not running Minecraft Java Edition (PC/Mac) 1.16, find NBT tags for player in another version of Minecraft: BackgroundPlayers have a unique set of NBT tags that can be used in Minecraft commands such as: /data and /scoreboard. What are NBT tags (formerly called Data Tags)?NBT tags (formerly called data tags) allow you to set certain properties of a player. The NBT tag is always surrounded in <> such as List of NBT TagsHere is a list of the NBT tags that you can use for a player in Minecraft Java Edition (PC/Mac) 1.16:
r ecursive research : indexes are always integers, except when they aren’t |
Java Edition (PC/Mac)
Pocket Edition (PE)
Xbox 360
Xbox One
PS3
PS4
Wii U
Nintendo Switch
Windows 10 Edition
Education Edition