Detecting Silk Touch Enchant

Hey! Could someone tell me what I am doing wrong? execute as @a at @s unless data entity @s SelectedItem.tag:{Enchantments:[{id:"16"}]} run give ... I also tried... execute as @a at @s if data entity @s[nbt={SelectedItem:{tag:{Enchantments:[{id:silk_touch}]}}}] run give ... I am trying to detect if the player is using silk touch or not mining a block to then give him the custom ore or the ingot, I have all the other stuff but this one does not work... I searched in google and this should work :/ (Minecraft Java 1.20.1)
7 Replies
Admincraft Meta
Thanks for asking your question!
Make sure to provide as much helpful information as possible such as logs/what you tried and what your exact issue is
Make sure to mark solved when issue is solved!!!
/close !close !solved !answered
Requested by twistedwar3713#0
Auster
Auster2y ago
execute as @a[nbt={SelectedItem:{tag:{Enchantments:[{id:"minecraft:riptide",lvl:3s}]}}}] run give... @TwistedWar3713 we dont use ids anymore
TwistedWar3713
TwistedWar3713OP2y ago
?
Auster
Auster2y ago
you need to give it a level to look out for i think
TwistedWar3713
TwistedWar3713OP2y ago
And there's not a way to don't specify a lvl? Because I may have a pickaxe with silk touch 10
Auster
Auster2y ago
i am not that familiar with commands, so maybe? idk tbh that was my only idea ngl
TwistedWar3713
TwistedWar3713OP2y ago
Hahah thanks anyways, I will try this for the moment, but let the post open in the case someone knows another solution

Did you find this page helpful?