SelectItem doesn't work but Inventory does
I just found out how item tags work and now I'm trying to check if the player is holding the sword with the tag. When I try to /execute if entity @e[nbt={SelectedItem:[{tag:{awakened:1b}}]}]
the test fails
but when i Try this command it works. /execute if entity @e[nbt={Inventory:[{tag:{awakened:1b}}]}]
it works. I am holding the item and it still doesn't want to work
If you are wondering this is the give command I used to get the tagged sword.
/give @p minecraft:diamond_sword{Unbreakable:1,HideFlags:1,Enchantments:[{id:"minecraft:sharpness",lvl:8}],awakened:1b,display:{Name:'[{"text":"Awakened arkhalis"}]'}} 1
Solution 1:
SelectedItem
is not a list and therefore does not take square brackets. Try /execute if entity @e[nbt={SelectedItem:{tag:{awakened:1b}}}]
instead.