Skip to content
MC Command Generator

Predicate Generator

Beta

Pick the conditions, choose whether all of them or just one must pass, and change the sample situation in the preview to see each check pass or fail. You get the predicate JSON for your Java version, the data pack, and two commands to test it.

Describe it — AI writes the command

Type what you want in plain words. The AI fills the form below, so you can see it and change anything. It follows the edition and version you picked.

Checking the AI…

Passes when
Condition 1
Condition 2

Checks the entity the command runs as (with /execute as) — usually the player.

Flags click: must be → must not be → off
Condition 3
Add a condition
07:00
FAIL
  • ✗rainingWeather
  • ✗Player, sneakingEntity (mob or player)
  • ✓NOT time 19:00–05:00Time of day

Every condition must pass. Tags (#…) count as a match here.

Change the situation and watch each condition pass or fail, the same way execute if predicate checks it.

Your command · Java 26.3

166 characters
/execute as @p at @s if predicate my_pack:sneaking_in_rain run say The predicate passed
/effect give @a[predicate=my_pack:sneaking_in_rain] minecraft:glowing 5 0 true
data/my_pack/predicate/sneaking_in_rain.json
{
  "type": "minecraft:all_of",
  "terms": [
    {
      "type": "minecraft:weather_check",
      "raining": true
    },
    {
      "type": "minecraft:entity_properties",
      "entity": "this",
      "predicate": {
        "minecraft:entity_type": "minecraft:player",
        "minecraft:flags": {
          "is_sneaking": true
        }
      }
    },
    {
      "type": "minecraft:inverted",
      "term": {
        "type": "minecraft:time_check",
        "clock": "minecraft:overworld",
        "value": {
          "min": 13000,
          "max": 23000
        },
        "period": 24000
      }
    }
  ]
}
  • Test it: the first line runs as the nearest player (the entity checks look at that player); the second makes every player who passes glow for 5 seconds.
  • Put the file in your data pack (or press Download data pack), drop the pack in your world's datapacks folder, then run /reload.

Raw editor

Read only — this generator writes files, edit them with the form.

How it works

A predicate is a saved check. The game runs it when a command asks: execute if predicate my_pack:check or the selector argument @a[predicate=my_pack:check]. Entity checks look at the entity the command runs as, so use execute as to pick who is tested.

Java 1.16 to 26.2

Files go in data/<namespace>/predicates/ (predicate/ from 1.21). Several conditions can be written as a list, and all of them must pass:

[
  {"condition": "minecraft:weather_check", "raining": true},
  {"condition": "minecraft:entity_properties", "entity": "this",
   "predicate": {"flags": {"is_sneaking": true}}}
]

“Any one passes” uses alternative before 1.20 and any_of after. Java 1.15 only reads one condition per file, so the generator writes “all of” as inverted(alternative(inverted…)), which means the same thing. From 26.1 a time check also names the clock it reads (minecraft:overworld).

Java 26.2 and 26.3

26.2 changed entity checks to keyed parts such as "minecraft:entity_type" and "minecraft:flags". 26.3 renamed condition to type and dropped lists, so several conditions become one all_of:

{"type": "minecraft:all_of", "terms": [
  {"type": "minecraft:weather_check", "raining": true},
  {"type": "minecraft:entity_properties", "entity": "this",
   "predicate": {"minecraft:flags": {"is_sneaking": true}}}
]}

Testing it

After /reload, run /execute as @p at @s if predicate my_pack:check run say The predicate passed. The second command the generator gives you makes every player who passes glow, which is handy for checking a crowd. Predicates are a Java data-pack feature, so there is no Bedrock version.

FAQ

How do I check if a player is sneaking?

Add an Entity condition and set the Sneaking flag to “must be”. Then run the command as the player: /execute as @a if predicate my_pack:sneaking run … Each player is checked on their own.

Why does my predicate always fail?

Most often the command doesn't run as the entity you meant, so entity checks test the server instead of a player. Use execute as @p (or @a). Also check the folder for your version: predicates before 1.21, predicate from 1.21.

How do I check the time of day?

Use a Time of day condition. Day starts at tick 0 (sunrise), noon is 6000, night is about 13000 to 23000. The generator sets period 24000 so it works on every day, not just the first.

Can I use a predicate in a target selector?

Yes: @e[predicate=my_pack:check] keeps only the entities that pass. Add several predicate= arguments to require all of them, or predicate=! to invert one.

What does Invert do?

It wraps the condition in minecraft:inverted, so it passes when the check fails. For example an inverted night-time check passes during the day.