0

After messing around a bit I made this command, designed to say “Doot” whenever I drop an iron ingot (I intend to make it do other things later on). However, something isn't working as supposed (it's snapshot by the way, so new command standards).

/execute at @e[type=item,nbt={Item:{id:"iron_ingot",Count:1,tag:{display:{Name:"{\"text\":\"Doot\"}"}}}}] run say doot

I know the items tags are working because this command works flawlessly:

/summon item ~ ~-3 ~ {Item:{id:"iron_ingot",Count:1,tag:{display:{Name:"{\"text\":\"Doot\"}"}}}}

So my problem is with /execute. It doesn't give any error logs nor any results. I believe the problem is with the @e[type=item,nbt=<-Here

Is the problem solvable or is the command invalid? Or should I just use scoreboard? (Never got around learning that.)

0

1 Answer 1

1

Minecraft will auto-fix some things for you when setting data, but when testing data you need to test for the NBT exactly as it exists.

You'll need to specify the namespace of IDs (minecraft:iron_ingot) and the correct data type of numbers (Count is a byte). The following command should work:

/execute at @e[type=item,nbt={Item:{id:"minecraft:iron_ingot",Count:1b,tag:{display:{Name:"{\"text\":\"Doot\"}"}}}}] run say doot

A good way to check the NBT data that something has is with /data get:

/data get entity @e[type=item,limit=1,sort=nearest]
1
  • It worked! Thanks a lot Benet - Now I'm off to make items turn into throwable landmines :)
    – Bryuf
    Commented Apr 20, 2018 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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