This site and this site both speak of an nbt path which allows me to put a certain value (say, the durability of the currently held tool in a player's hand) into a scoreboard. The wiki describes a path like this:

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.

However, I don't understand what they mean by this. I know foo and bar are just dummy programming terms and that [] are for indices (say Pos[0] or Motion[1]), but I don't understand what the child and string notation is/how it is used.

This post has /data get entity @e[type=minecraft:villager,limit=1,sort=nearest] Brain to get a villager's home location, and I have used /data get entity @s Pos[0] before, but that is getting nbt about an entity specifically, not the contents of their inventory.

If someone could explain what the wiki excerpt means (preferably with examples) and also an example of getting nbt from an inventory item (again, say, the durability of the currently held tool in a player's hand) that would be very helpful.

  • That wiki page you linked describes paths. Is your real question what the path to the durability is? You can just use data get entity @s to see all your data. May 5, 2019 at 7:02
  • @FabianRöling Edited question to make it more clear. I tried data get and got a ton of info, including the Damage of the item in my hand, but I'd like to understand why I'm doing something so I can write commands quicker.
    – Nik3141
    May 5, 2019 at 19:03
  • What is your exact, specific question? What do you want explained? That foo.bar[0] means the first entry in the list tag bar in the tag foo? May 5, 2019 at 19:58
  • 1
    @FabianRöling My exact question is that "I don't understand what the child and string notation is/how it is used" and I'd like that explained to me, maybe with a real example. Additionally, I'd like "an example of getting [an nbt value] from an inventory item" and an explanation of how the example works.
    – Nik3141
    May 5, 2019 at 20:13
  • My question isn't asking for an exact, specific answer or fix to a problem but a more general explanation of a system. Is that acceptable on this forum or are questions supposed to be limited to those with exact and specific answers? I know that extended discussions about gaming topics are discouraged but I thought that general questions like this one are okay. Apologies if I have misplaced this question. If this question is misplaced, where/what is an acceptable forum for it?
    – Nik3141
    May 5, 2019 at 20:24

1 Answer 1


"Child" tags are just tags inside other tags. Like "memories" is a child tag of "Brain".

The string notation is a bit misleading, you can't actually use it for strings in NBT. It's used if an NBT tag's name contains special characters, like a period, a square bracket, etc. No normal Vanilla NBT tag contains such special characters, but it is possible in a few places to use custom NBT tags.

If you want to get the damage on the item in your hand, use /data get entity @s SelectedItem.tag.Damage 1. The Player.dat wiki page shows player tags, and if you use SelectedItem (which returns an item) you need to look at the Item Structure tags, and see that the tag: tag has information about the item itself. Going to the general tags shows you the Damage tag. Therefore, you chain these together to get SelectedItem.tag.Damage.

  • Couldn't figure out anywhere else to ping you so I'll delete this comment once you get it. I have a question about data values in this chat that I made.
    – Nik3141
    Jul 25, 2019 at 14:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .