Testing for custom item names depend heavily on the placement of the text components.
Example:
When testing for an item named "Sun's Cowl" with no italics
This doesn't work:
/execute as @a if data entity @s Inventory[{Slot:103b,id:"minecraft:player_head",components:{"minecraft:custom_name":'{"text":"Sun\'s Cowl","italic":false}'}}] run say @s
But this does:
/execute as @a if data entity @s Inventory[{Slot:103b,id:"minecraft:player_head",components:{"minecraft:custom_name":'{"italic":false,"text":"Sun\'s Cowl"}'}}] run say @s
Desired result:
Testing for the components won't matter where the same components were placed
Comments 2
I can't make either work.
Please include the following information to help us understand your problem:
Steps to Reproduce:
1. (Explain what needs to be done for the issue to happen)
2.
3.Observed Results:
(Briefly describe what happens)Expected Results:
(Briefly describe what should happen)
Please also attach any needed commands, add-ons/behavior packs, data packs, resource packs, screenshots, videos, or worlds needed to help reproduce this issue.
Refer to the Bug Tracker Guidelines for more information about how to write helpful bug reports. Bug reports with insufficient information may be closed as Incomplete.
This issue is being temporarily resolved as Awaiting Response. Once the requested information has been delivered, the report will be reopened automatically.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
NBT tests have to match exactly; any differing value is deemed not a match by definition.
This is not a bug, and you shouldn't rely your systems on player-facing strings. Use custom data instead. See MC-175743.