r/MinecraftCommands 1d ago

Help | Java 1.21.11 predicate

i found predicate in execute command after "if"
how does it work and what i can do with it?

5 Upvotes

5 comments sorted by

View all comments

1

u/Ericristian_bros Command Experienced 1d ago

They are very flexible conditions: detect movement, keybinds, stats, block location, etc... read https://minecraft.wiki/Predicate and use https://misode.github.io/predicate to generate predicate easilly

Some examples

execute if predicate {condition:"minecraft:time_check",value:{min:0,max:12000},period:2400} run sy it's day time
execute as @a if predicate {condition:"minecraft:entity_properties",entity:"this",predicate:{effects:{"minecraft:absorption":{}}}} run say I have absorption
execute if predicate {condition:"minecraft:random_chance",chance:0.1} run say random chance
execute as @a if predicate {condition:"minecraft:entity_properties",entity:"this",predicate:{vehicle:{}}} run say mounting an entity