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.
-
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).– Fabian RölingCommented May 5, 2020 at 13:27
-
Java Edition (Pc)– HanzCommented May 5, 2020 at 13:33
-
1OK, then the existing answer is valid.– Fabian RölingCommented May 5, 2020 at 13:34
Add a comment
|
1 Answer
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\"}"
-
Can you send me the command for this item: Italic: false, bold: true, Color: Gold, item:golden_pickaxe,name:"a" thx– HanzCommented 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
-