mojira.dev
MC-130002

Error detecting items (with commands) renamed on an anvil.

Explanation of the video (and the bug):

On the right, the purple command block will add a point to all items with the name "1".
(scoreboard players set @e[type=item,nbt={Item:{tag:{display:{Name:"1"}}}}] test 1)

And the center command block will give me a diamond with the name "1"
(give @p minecraft:diamond{display:{Name:"1"}} 1)

The purple block perfectly detects the diamond awarded by the center's command block; but, when I put a diamond from the inventory on an anvil and name it "1", it does not detect it anymore.

This happens because in the NBT Tags of the diamond awarded by the command block, you can see: {Name:"1"}, while in the renamed diamond you can see: {Name: "{\"text\":\"1\"} Thanks to this, the purple command block no longer detects the renamed item.

Attachments

Comments 6

Please do not mark unreleased versions as affected.
You don't have access to them yet.

There's quite clearly no bug here. The command matches the given item because the NBT matches, and does not match the renamed item because the NBT does not match.

Yes, I understand that, but it should work ... come on, that the item is still called "1". Also, when the Item has color, change its format to: {Name:"{\"text\":\"1\",\"color\":\"blue\"}"}

So, what if I want only detect the name of the item but not the color?

This does not work @e[type=item,nbt={Item:{tag:{display:{Name:"{\"text\":\"1\"}"}}}}] since the Diamond has the name "1" but in blue color: then I have to use @e[type=item,nbt={Item:{tag:{display:{Name:"{\"text\":\"1\",\"color\":\"blue\"}"}}}}]

Any suggestions? Should I simply include the color specification?
Thank you!

Indeed, it needs to match exactly. I would recommend identifying items by something other than their name.

oh, ok! thanks! and sorry :s

No worries, good luck!

Felipe

(Unassigned)

Unconfirmed

Minecraft 18w20c

Retrieved