Skip to content

Conditions

All 26 tests, plus and / or / not, for if, while and wait-until.

A condition is a value block, not an action. It never stands on its own: it plugs into the socket on an if, a while or a wait until, or into one of the and / or / not blocks at the bottom of this page.

Every test is the same block, test, with a dropdown choosing which one. The rest of its fields light up according to that choice:

FieldUsed by
the text boxthe item, chat, block and variable tests
the match dropdown (registry name / display name / lore)the item tests
the comparison (at least, more than, exactly, at most, fewer than) and the numberthe counting and threshold tests
the variable rowthe three variable tests
the coordinate row, with "relative to the client"client-at-coords and block-at-coords

Nesting is bounded: conditions may be 6 levels deep, and an and / or block takes at most 10 children.

Item and block conditions match a real item or block name exactly (diamond is not a diamond_sword); a partial word such as sword or planks matches any name containing it.

has_item

True when the client is carrying the named item.

if test has item cooked_beef
notify owner: food in the bag

holding

True when the named item is in the client's hand.

if test holding item fishing_rod
use held item

inventory_full

True when no inventory slot is free.

if test inventory full
drop cobblestone by name x 0 to player — all of it ☑

health_below

True when health is under the number. 20 is full hearts.

if test health below 8
command /spawn

health_above

True when health is over the number.

wait until test health above 18 give up after 60 seconds — count a timeout as failed ☑

food_below

True when hunger is under the number. 20 is full.

if test food below 10
notify owner: the client is hungry

food_above

True when hunger is over the number.

if test food above 16
dig nearest oak_log within 24 blocks, 8 time(s)

item_count

Compares how many of an item the client carries against a number. This is the test that uses the comparison dropdown.

while test count of item cobblestone by name fewer than 256
dig nearest stone within 8 blocks, 1 time(s)

free_slots_below

Compares the number of empty inventory slots against a number. Despite the name, the comparison dropdown applies, so it can also mean "more than".

while test free slots more than 2
dig nearest stone within 8 blocks, 1 time(s)

container_has_item

True when the open container holds the named item. Needs a window open, so pair it with open container.

when run manually or by webhook
open container nearest container x y z · radius 6
if test open container has diamond
take diamond by name x 0 from container — all of it ☑
close container

player_near

True when any player is within the number of blocks.

if test player within 16
chat hello

Unlike the player_near trigger, which fires once on entry, this simply asks whether someone is there right now.

player_near_named

True when the named player is within the number of blocks (0 means 16). The name matches whatever its case.

if test named player near Alice
follow on player Alice at 3 blocks

mob_near

True when a hostile mob is within range.

if test hostile mob near 8
attack nearest hostile mob

chat_matches

True when the latest chat line matches the pattern. Only meaningful inside a chat-driven firing. When the line has a sender (<Alice> !stop, [VIP] Alice: !stop), the pattern sees only the message after the name, so ^!stop$ matches; a line with no sender is tested whole.

on chat matching — only when sent by Alice
if test chat matches ^!stop$
stop client

time_of_day

True when the real clock is between two times, in UTC.

if test real time between (UTC) 22:00-06:00
log night shift

Write whole hours (08-20) or hours and minutes (08:30-17:45). The start counts, the end does not, and a range whose end is earlier than its start runs past midnight. Anything else is refused when you save the flow.

For the in-game clock use mc_time_between.

mc_time_between

True when the in-game clock is between two times.

if test in-game time between 13000-23000
notify owner: night on the server

Write the times as game ticks (13000-23000, 0 to 24000, where 0 is sunrise and 6:00 in the game), as hours (18-06) or as hours and minutes (19:30-05:00) of the in-game day. A range whose end is earlier than its start runs past midnight. Anything else is refused when you save the flow.

is_day

True during the in-game day.

while test it is daytime (in game) (max 1000x)
dig nearest wheat within 16 blocks, 1 time(s)

is_raining

True while it is raining.

if test it is raining
notify owner: rain started

is_thundering

True during a thunderstorm. Worth separating from rain: a thunderstorm is what lets the client sleep during the day.

if test thunderstorm
notify owner: thunderstorm overhead

players_online

Compares the server's player count against a number.

if test players online at most 1
stop this flow run

at_coords

True when the client is within a radius of a position. The radius is the number field, and defaults to 2 blocks. Tick "relative to the client" to read the coordinates as an offset instead.

if test client at coords at x 100 y 64 z 100, radius 4
log home

block_at

True when the block at a position is the named one. Takes the same coordinate row, with the same relative option.

if test block at coords is chest at x 0 y 0 z 1, relative to the client ☑
open container looking at x y z · radius

last_action_failed

True when the step just before it reported a failure. The way to check instead of guessing: a container action with no window open, or a wait that timed out with its fail box ticked. Only the latest step counts: one that succeeds clears it, and so does a log, wait or set_var in between. A repeat, while or if passes on what its last step left, and a try counts as one step.

open container nearest container x y z · radius 6
if test last action failed
notify owner: no chest in reach

var_equals

True when a flow variable equals the text, compared as text.

if test variable equals text done — variable state
stop this flow run

var_number

Reads a variable as a number and compares it, using the comparison dropdown.

while test variable as number fewer than 64 — variable mined
dig nearest stone within 8 blocks, 1 time(s)
add 1 to variable mined

var_matches

True when a variable matches a regular expression.

if test variable matches ^\d+$ — variable balance
log balance is numeric

all

True only when every child condition is true. This is AND. Takes up to 10 children.

if all of
test it is daytime (in game)
test food above 14
then
dig nearest wheat within 16 blocks, 1 time(s)

any

True when at least one child condition is true. This is OR. Takes up to 10 children.

if any of
test health below 8
test hostile mob near 6
then
command /spawn

not

Inverts a condition.

if not
test has item cooked_beef
then
notify owner: out of food

Only the first child counts. A not given several children ignores all but the first. Wrap them in an all or any if you meant to negate the group.