0

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.

3
  • Which game are you playing, MCJava, MCBE, MCCE, …? The answer depends on that (and you're supposed to state that anyway, see tag wiki of minecraft-commands). Commented May 5, 2020 at 13:27
  • Java Edition (Pc)
    – Hanz
    Commented May 5, 2020 at 13:33
  • 1
    OK, then the existing answer is valid. Commented May 5, 2020 at 13:34

1 Answer 1

1

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\"}"
3
  • Can you send me the command for this item: Italic: false, bold: true, Color: Gold, item:golden_pickaxe,name:"a" thx
    – Hanz
    Commented May 5, 2020 at 12:58
  • @Hanz You can use the same command and just adjust the things you want to check for accordingly. Commented May 5, 2020 at 13:35
  • It doesnt work…, can you send me pls?
    – Hanz
    Commented May 5, 2020 at 13:37

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.