How can i test for a item with a Color, or bold, etc Name in Players inventory? Ist work only with names without Color, but I want Color/bold items to test.


Like this:

/execute if entity @a[nbt={Inventory:[{id:"minecraft:stick",tag:{display:{Name:'{"text":"someText","color":"blue","bold":"true"}'}}}]}] run say hi

Also, The item name can be defined in multiple formats. You have to use the same format in both your generation and detection commands. Here's an example of some formats:

  • Name: '"someText"'
  • Name:"\"someText\""
  • Name:'{"text":"someText"}'
  • Name:"{\"text\":\"someText\"}"