TransWikia.com

Why is my worn item detector not working? (1.15.2 Minecraft)

Arqade Asked by DetectiveINC on July 25, 2021

I have worked on creating an item that can make you fly by sneaking but the detector is consistently failing. It is a scoreboard system and this is the item NBT:

leather_boots{display:{Name:"[{"text":"Glass Boots","italic":false,"color":"white"}]",Lore:["[{"text":"Can be used to fly!","italic":true,"color":"dark_blue"}]"],color:3847130},Enchantments:[{id:flame,lvl:1}],Unbreakable:1,HideFlags:39,AttributeModifiers:[{AttributeName:"generic.armor",Amount:66,Operation:0,UUIDLeast:171565600,UUIDMost:99,Slot:feet,Name:"generic.armor"}]} 1.

Scoreboard command:

/scoreboard players add @a[nbt={Inventory:[{Slot:100b,display:{Name:"{"text":"Glass Boots","italic":false,"color":"white"}"}}]}] Wearing_Glass 1

What is wrong with my command?

One Answer

You are using an array in the 1st Name tag, and not on the 2nd. This means the following are different:

[{"text":"hello world"}]
 {"text":"hello world"}

When performing comparisons on NBT JSON tags, it does a text comparison against the raw JSON elements. This means, that even if the text will render the same, it must be typed exactly the same or it won’t register.

To make things simpler, surround the entire JSON text string in single quotes ' instead of double quotes ". (1.15 only) Try the bottom instead of the top:

Name:"{"text":"hello world"}"
Name:'{"text":"hello world"}'

Please let me know in the comments if any additional errors arise.

Answered by ExpertCoder14 on July 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP