Why is my item with enchantments not being detected?
//ads -- adsterra.com -- native banner
?>
I want to test for an enchanted diamond sword when it is held in the player's hand. I tried this command:
execute if entity @p[nbt={SelectedItem:{id:minecraft:diamond_sword,tag:{Enchantments:[{id:"minecraft:sharpness",lvl:4}]}}}]
For some reason, this isn't detecting a Sharpness sword that I made using an anvil. However, when I /give myself a Sharpness sword with this command, this item is detected:
give @s minecraft:diamond_sword{Enchantments:[{id:"minecraft:sharpness",lvl:4}]}
What is differentiating my /given sword with the anvil-created sword, and how can I make the anvil-created sword be detected by the command?
Pictures about "Why is my item with enchantments not being detected?"



Minecraft Enchanting: You use Anvils WRONG :(
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Orhun Rüzgar ÖZ, Andrea Piacquadio, cottonbro, Ketut Subiyanto
