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.

TIP: Starting in Minecraft Java Edition (PC/Mac) 1.13, the /data command replaces both the /entitydata command and the /blockdata command.

Let’s explore how to use this cheat (game command).

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:

/data get block <pos> [path] [scale]

To get the NBT tag for an entity:

/data get entity <target> [path] [scale]

To merge the NBT tags for a block entity:

/data merge block <pos> <nbt>

To merge the NBT tags for an entity:

/data merge entity <target> <nbt>

To remove the NBT tags at path for a block entity:

/data remove block <pos> <path>

To remove the NBT tags at path for an entity:

/data remove entity <target> <path>

Definitions

  • pos is the x y z coordinate of a block entity you wish to target.
  • path is optional. It is path to the NBT tag.
  • scale is optional. It is used to set the scale of a number retrieved by the /data command.
  • target is the name of the player (or a target selector) whose NBT tag you wish to target. If a target selector is provided, it must resolve to a single entity and not multiple entities.
  • nbt is the NBT tag (formerly called data tag) to merge or remove.

Examples

Example in Java Edition (PC/Mac)

To change the name of one cow to Duke in Minecraft Java Edition (PC/Mac):

/data merge entity @e[type=cow,limit=1] {CustomName:"\"Duke\""}

To get all NBT tag information for one player that is in Creative mode:

/data get entity @a[gamemode=creative,limit=1]

To get all NBT tag information for a chest at coordinates (329, 68, 91):

/data get block 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:

  • For Java Edition (PC/Mac), press the T key to open the chat window.

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:

/data get block 329 68 91

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:

329,68,91 has the following block data:{x:329,y:68,z:91,
Items:[{Slot:0b,id:"minecraft:diamond_sword",Count:1b,tag:{
Damage:0}},{Slot:1b,id:"minecraft:iron_helmet",Count:1b,tag:
{Damage:0}},{Slot:2b,id:"minecraft:iron_chestplate",Count:1
b,tag:{Damage:0}},{Slot:3b,id:"minecraft:iron_leggings",
Count:1b,tag:{Damage:0}},{Slot:4b,id:"minecraft:iron_boots",
Count:1b,tag:{Damage:0}}],id:"minecraft:chest",Lock:""}

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.

Click to rate this post!
[Total: 2 Average: 5]