0

I am making spells for an adventure map and SelectedItem doesn't work when the item is summoned with unbreakable it.

I have right click detection which is what the spell score is and the mana score is for detecting if you have enough mana to summon the spell.

/execute as @a at @s if entity @s[scores={spell=1..},] if entity @s[scores={mana=10..}] run execute at @a[nbt={SelectedItem:{id:"minecraft:diamond_sword",tag:{display:{Name:'{"text":"Awakened arkhalis"}'}}}}] run setblock ~ ~ ~ minecraft:redstone_block

All the other times I use SelectedItem it works but for some reason when I give myself this sword it doesn't

/give @s minecraft:diamond_sword{Unbreakable:1,HideFlags:1,Enchantments:[{id:"minecraft:sharpness",lvl:8}],display:{Name:'[{"text":"Awakened arkhalis"}]'}} 1

Is there any way to make the diamond sword detectable?

1