I'm in Java and currently trying to figure out a way to test if a player is wearing armor with any level of the protection enchantment using the "/execute if items" command.
Currently, I have this:
/execute if items entity @s armor.* *[minecraft:enchantments={levels:{"minecraft:protection":4}}]
This test will pass if the player is wearing any armor with Protection 4 on it. However, I need a way to test if the player has ANY level of protection, not just 4.
Any advice/answers are greatly appreciated!
Edit: I am doing this in a datapack, so predicate suggestions also work!
Hi all,
Minecraft 1.21 messed our commands up.
I'm in Java and currently trying to figure out a way to test if a player is wearing armor with any level of the protection enchantment using the "/execute if items" command.
Currently, I have this:
This test will pass if the player is wearing any armor with Protection 4 on it. However, I need a way to test if the player has ANY level of protection, not just 4.
Any advice/answers are greatly appreciated!
Edit: I am doing this in a datapack, so predicate suggestions also work!
I ended up figuring this out through this predicate generator!
https://misode.github.io/predicate/
Here is the predicate:
When run, this predicate will detect if the target is wearing any armor with any level of protection.
Figured I would leave this up if anyone else was struggling with the same issue.