I'm trying to select a diamond axe which is on the ground and has no durability used up. I have the command execute as @e[type=item,nbt={Item:{id:"minecraft:diamond_axe",Count:1b,Damage:0}}] at @s run say hi, but when I throw an axe on the ground, in creative or survival, having gotten the axe through the inventory or with/give, it does nothing. I've added b, s, l, f, and d after the 0 in the Damage selector, and still nothing. I can give myself a diamond axe with some amount of damage, but I can't seem to select it off the ground. Why is this/what am I doing wrong?

  • 1
    I'm pretty sure Damage belongs in the tag tag. /data get entity @e[type=item,sort=nearest,limit=1] is your friend in these cases, or F3+I. Also, maybe the Damage tag doesn't exist on fresh items. – Fabian Röling Apr 29 '19 at 6:23
  • 1
    Just checked the wiki, and Damage is indeed inside the tag tag. It does default to 0, though, so it should be there on any item that has the tag (I had thought that 0 meant the item was destroyed, but that doesn't seem to be the case). – MBraedley Apr 29 '19 at 15:57
  • Sorry but on a side note how can I put the damage of a tool into a scoreboard, if it's in a player's inventory? Or should this be a separate question? – Nik3141 Apr 29 '19 at 16:52
  • @Nik3141 In theory it's a separate question, but in practice you can just look at the wiki. The page is called "chunk format" and has EVERYTHING about NBT. – Fabian Röling Apr 30 '19 at 7:47
  • @FabianRöling Sorry I looked at it but I can't find anything about tool durability in the inventory. I see dropped items, mobs, dynamic tiles, blocks, chunks, projectiles, vehicles and other. Could you link the portion of the wiki with it or should I ask a new question for it? – Nik3141 May 4 '19 at 17:36

Damage is in the tag tag and you need the "byte" type:

| improve this answer | |

/data get entity @s Inventory shows that undamaged items do not have a Damage tag. You have to supply it with /give @s diamond_axe{Damage:0}.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.