I'm using the following command in a command blockI want to test for an enchanted diamond sword when it is held in a chest next to the player's hand. I tried this command block:
/testforblock ~1 ~ ~execute minecraft:chestif -1entity @p[nbt={ItemsSelectedItem:[{id:minecraft:diamond_sword,tag:{enchEnchantments:[{id:2"minecraft:sharpness",lvl:4}]}}]}]
It detectsFor some reason, this isn't detecting a Sharpness sword that I usedmade using an anvil. However, when I /give
to get that already had Feather Falling 4, but it doesn't detectmyself a Feather FallingSharpness sword that I made using the anvil. Neither are named and are identical otherwise.
Is there some tag that differentiates the two? How would I get mywith this command block to accept both?, this item is detected:
give @s minecraft:diamond_sword{Enchantments:[{id:"minecraft:sharpness",lvl:4}]}
(Feather Falling was just one I picked while What is differentiating my /give
n sword with the anvil-created sword, and how can I getmake the anvil-created sword be detected by the command down)?