Skip to content

Conditions

Conditions test the current context and return true or false. Entity conditions look at one entity context. Bi-entity conditions compare an actor and a target.

FamilyRegistered Types
State flagspheno:alive, pheno:daytime, pheno:exists, pheno:glowing, pheno:hostile, pheno:invisible, pheno:on_fire, pheno:passenger, pheno:riding, pheno:tamed, pheno:using_item
Numeric checkspheno:air_supply, pheno:fall_distance, pheno:hunger, pheno:thirst, pheno:energy, pheno:max_health, pheno:saturation_level, pheno:xp_levels, pheno:xp_points, pheno:health, pheno:brightness, pheno:velocity, pheno:dimensions, pheno:fluid_height, pheno:scale, pheno:count
Movement and posepheno:movement
Social interactionpheno:interaction
World, weather, and fluidspheno:biome, pheno:block, pheno:block_in_radius, pheno:building, pheno:dimension, pheno:distance_from_coordinates, pheno:environment, pheno:in_fluid, pheno:structure, pheno:submerged_in, pheno:time_of_day, pheno:village
Entity identitypheno:entity_type, pheno:in_tag, pheno:entity_group, pheno:root
Villager statepheno:mood (min/max over -15..15, or is with band names depressed/sad/unhappy/passive/fine/happy/overjoyed), pheno:gender (is: male/female/neutral; masculine/feminine aliases). Both evaluate on server and client alike. Mood matches villagers only. Gender matches villagers and players with MCA data; entities without an MCA gender never match, so wrap in pheno:not when unknown bearers should pass.
Player and inventorypheno:gamemode, pheno:inventory, pheno:equipped_item
Effects and cooldownspheno:on_cooldown, pheno:since_spawn, pheno:status_effect, pheno:status_effect_tag
Pheno systemspheno:ability, pheno:compare_resource, pheno:resource, pheno:toggled, pheno:variant, pheno:collection_size, pheno:collection_contains, pheno:collection_count
Logic and selectionpheno:and, pheno:or, pheno:not, pheno:any, pheno:none, pheno:constant, pheno:chance, pheno:entity_in_radius

State flag conditions take no fields beyond type. They read live entity state and return true or false.

TypeTrue When
pheno:aliveThe entity is alive.
pheno:daytimeThe level is currently day.
pheno:existsAlways true for the current context entity.
pheno:glowingThe entity is currently glowing.
pheno:hostileThe entity implements Minecraft’s hostile enemy marker.
pheno:invisibleThe entity is invisible.
pheno:on_fireThe entity is on fire.
pheno:passengerThe entity has at least one passenger.
pheno:ridingThe entity is riding another entity.
pheno:tamedThe entity is a tameable animal and is tamed.
pheno:using_itemThe entity is using an item.

pheno:movement checks the entity’s current movement, pose, flight, or collision state.

MovementTrue When
groundedThe entity is treated as on the ground.
movingThe entity has horizontal movement.
sneakingThe entity is sneaking.
sprintingThe entity is sprinting.
crawlingThe entity is visually crawling.
swimmingThe entity is swimming.
climbingThe entity is on a climbable block.
sleepingThe entity is sleeping.
fall_flyingThe entity is fall flying.
ascendingThe entity is airborne and moving upward.
descendingThe entity is airborne and moving downward.
creative_flyingThe entity is a player currently flying in creative-style flight.
colliding_horizontallyThe entity has side collision.
colliding_verticallyThe entity has vertical collision.
emotingThe entity is currently running a Townstead-triggered emote.
reactingThe entity is currently playing a locking Townstead reaction.

pheno:interaction checks social or UI-driven interaction state.

InteractionTrue When
in_dialogueThe entity is currently in the Townstead RPG dialogue screen with a player.
dialogue_just_endedThe entity’s Townstead RPG dialogue closed recently.
heart_increasedThe entity’s MCA relationship hearts with the interacting player went up recently.
heart_decreasedThe entity’s MCA relationship hearts with the interacting player went down recently.

These conditions accept min and max. Missing min means no lower bound; missing max means no upper bound. Player-only values return no match for non-player entities.

TypeValue Tested
pheno:air_supplyCurrent air supply.
pheno:fall_distanceCurrent fall distance.
pheno:hungerPlayer food level or Townstead villager hunger.
pheno:thirstTownstead villager thirst, or player thirst when the active thirst compatibility bridge can read it.
pheno:energyTownstead villager energy, derived from fatigue.
pheno:max_healthEntity max health.
pheno:saturation_levelPlayer saturation.
pheno:xp_levelsPlayer experience level.
pheno:xp_pointsPlayer total experience points.

pheno:health also accepts min and max. Add "relative": true to compare health as a fraction of max health from 0 to 1; otherwise it compares raw health points. Defaults are min: 0, no practical max, and relative: false.

pheno:brightness tests local raw brightness at the entity position. Defaults are min: 0 and max: 15.

pheno:attribute tests a vanilla attribute value. Fields:

FieldDescription
attributeRequired attribute id, such as minecraft:generic.movement_speed.
minOptional lower bound.
maxOptional upper bound.
TypeFieldsDescription
pheno:andconditionsTrue when every child condition passes. An empty list is true.
pheno:orconditionsTrue when any child condition passes. An empty list is true.
pheno:notconditionNegates one child condition.
pheno:constantvalueAlways returns value; defaults to true.
pheno:chancechancePasses randomly per evaluation. chance defaults to 0.5 and is clamped from 0 to 1.

Comparisons use comparison strings: ==, !=, <, <=, >, >=, plus word aliases such as equal, less, and greater. Unknown or missing comparisons default to >=.

TypeFieldsDescription
pheno:anyonTrue when the selector returns at least one target.
pheno:noneonTrue when the selector returns no targets.
pheno:counton, comparison, compare_toCompares selector result count. comparison defaults to >=; compare_to defaults to 1.

pheno:entity_in_radius counts nearby living entities. It accepts radius (default 8), comparison (default >=), compare_to (default 1), and an optional nested entity condition. The bearer itself is not counted.

TypeFieldsDescription
pheno:biomebiome, biome_tag, conditionTests the biome at the entity position. condition takes priority, then biome_tag, then biome.
pheno:blockx, y, z, block_conditionTests a block relative to the entity’s block position. Offsets default to 0; block_condition is required.
pheno:block_in_radiusradius, block_condition, comparison, compare_toCounts matching blocks in a cube around the entity. radius defaults to 4 and is clamped from 0 to 8; comparison defaults to >=; compare_to defaults to 1.
pheno:buildingbuilding, building_type, id, village, village_id, min_size, max_sizeTests the Townstead/MCA building at the entity position. With no fields, true when the entity is in any known building. building accepts a full type id or slug, such as mca:tavern or tavern; building_type is an alias.
pheno:dimensiondimensionTests the level dimension id, such as minecraft:overworld.
pheno:distance_from_coordinatesx, y, z, min, max, ignore_yTests distance from the entity to fixed coordinates. Coordinates default to 0; min defaults to 0; ignore_y defaults to false.
pheno:environmentweather, exposure, time, biome, dimension, effectsConvenience condition that combines several world and effect checks. Present categories are ANDed; list values inside a category are ORed.
pheno:structurestructureServer-side check for whether the entity is standing inside a generated structure piece with the given id.
pheno:in_fluidfluid, fluid_tagTests whether the entity is standing in a fluid tag. fluid_tag takes priority; fluid supports minecraft:water, minecraft:lava, or another fluid tag id and defaults to water.
pheno:submerged_influid, fluid_tagTests the fluid at the entity’s eyes. fluid_tag takes priority; fluid supports minecraft:water, minecraft:lava, or another fluid tag id and defaults to water.
pheno:time_of_daymin, maxTests day time modulo 24000. Defaults are min: 0, max: 24000.
pheno:villageid, village, village_id, name, village_name, within_border, min_buildings, max_buildings, min_population, max_populationTests the MCA/Townstead village resolved at the entity position. With no fields, true when a village is found near the entity. Use within_border: true when the entity must be inside the village border.

pheno:environment uses weather for level-wide weather state and exposure for what reaches the entity at its position.

FieldAccepted Values
weatherrain, thunder, thunderstorm, clear
exposuresky, sun, rain, thunder, thunderstorm, snow
timeday, night
biomeBiome id values.
dimensionDimension id values.
effects.anyStatus effect id, or #tag for a mob-effect tag. effects.count.min sets the tag minimum count.
Environment FieldTrue When
weather: "rain"The level is raining.
weather: "thunder" or weather: "thunderstorm"The level is thundering.
weather: "clear"The level is not raining.
exposure: "sky"The entity’s block position can see the sky.
exposure: "sun"It is day, the level is not raining, and the entity can see the sky.
exposure: "rain"It is raining at the entity’s block position.
exposure: "thunder" or exposure: "thunderstorm"The level is thundering and it is raining at the entity’s block position.
exposure: "snow"It is precipitating at the entity’s block position, and the local biome precipitation is snow.

block_condition objects support "inverted": true on any condition. Names may be written with or without the pheno: namespace.

TypeFieldsDescription
blockblockTests an exact block id.
in_tagtagTests a block tag.
block_stateproperty, valueTests a block-state property value.
fluidfluid_condition, fluid, tagTests the block’s fluid state. A nested fluid_condition takes priority; otherwise fluid supports empty/none, water, lava, or any non-empty fluid, and tag tests a fluid tag.
exposed_to_skynoneTrue when the block position can see the sky.
airnoneTrue when the block is air.
in_rainnoneTrue when it is raining at that block position.
rainingnoneTrue when the level is raining.
thunderingnoneTrue when the level is thundering.
light_levelmin, maxTests local raw brightness. Defaults are 0 and 15.
heightmin, maxTests the block Y coordinate.
hardnessmin, maxTests destroy speed.
blast_resistancemin, maxTests explosion resistance.
slipperinessmin, maxTests friction/slipperiness.
replaceablenoneTrue when the block can be replaced.
movement_blockingnoneTrue when the block blocks movement.
light_blockingnoneTrue when the block blocks light.
water_loggablenoneTrue when the block can hold water.
block_entitynoneTrue when a block entity exists at the position.
distance_from_coordinatesx, y, z, min, maxTests distance from the block position to fixed coordinates.
offsetx, y, z, conditionTests another block position offset from the current one.
adjacentconditionTrue when any adjacent block passes the nested condition.
andconditionsTrue when every child block condition passes.
orconditionsTrue when any child block condition passes.
constantvalueAlways returns value; defaults to true.

Nested fluid_condition objects support "inverted": true.

TypeFieldsDescription
emptynoneTrue when the fluid state is empty.
in_tagtagTests a fluid tag.
stillnoneTrue when the fluid is a source block.
andconditionsTrue when every child fluid condition passes.
orconditionsTrue when any child fluid condition passes.
constantvalueAlways returns value; defaults to true.
TypeFieldsDescription
pheno:dimensionswhich, min, maxTests live bounding-box width, height, or both. which is width, height, or both; default both.
pheno:scalewhich, min, maxTests Townstead/MCA scale factors. Non-villager entities read as scale 1.0; which defaults to both.
pheno:velocityaxis, min, maxTests velocity. axis is x, y, z, horizontal, or total; default total.
pheno:fluid_heightfluid, min, maxTests the entity’s height in a fluid tag. fluid is required and is interpreted as a fluid tag id.
TypeFieldsDescription
pheno:entity_typeentity_type, tagTests an exact entity type or an entity type tag. tag takes priority.
pheno:in_tagtagAlias-style entity type tag check.
pheno:entity_groupgroupTests the expressed creature group, such as default, undead, arthropod, illager, or aquatic.
pheno:rootrootTests the entity’s current root id.
pheno:abilityabilityTrue when an innate ability is currently active.
pheno:toggledgeneTrue while a toggle gene is switched on.
pheno:variantgene, variant or is listTrue while the entity’s expressed allele of a variant gene carries one of the named variants. Lets a heritable style drive powers: which aura a revealed form fires, or a bonus tied to one tusk style.

Known ability keys are climbing, water_breathing, fire_immunity, night_vision, slow_fall, lava_vision, invisibility, swimming, walk_on_fluid, ignore_water, hover, sprinting, aerial_affinity, grounded, elytra_flight, creative_flight, and phasing.

TypeFieldsDescription
pheno:gamemodegamemodePlayer-only. Tests survival, creative, adventure, or spectator.
pheno:equipped_itemslot, item_conditionTests an equipment slot. slot defaults to mainhand; valid slots include mainhand, offhand, head, chest, legs, and feet. If item_condition is omitted, the condition only checks that the slot is occupied.
pheno:inventoryitem_condition, min, maxPlayer-only. Counts matching items across the inventory. min defaults to 1; max has no practical default limit.
pheno:on_cooldownitemPlayer-only. Tests whether an item is currently on cooldown.
pheno:status_effecteffect, min_amplifierTests an active status effect. min_amplifier defaults to 0.
pheno:status_effect_tagtag, min_countCounts active effects in a mob-effect tag. min_count defaults to 1.
pheno:since_spawncomparison, valueCompares ticks since the entity’s first server-side evaluation. The shared first-seen stamp is saved in entity data; defaults are comparison: >=, value: 0.
pheno:resourceresource, min, maxTests the value of a resource gene.
pheno:compare_resourceresource, comparison, compare_to, compared_to_resourceCompares one resource gene to a fixed value or to another resource gene. comparison defaults to >=; compare_to defaults to 0.

Nested item_condition objects support "inverted": true.

TypeFieldsDescription
amountmin, maxTests stack count. Defaults are min: 1, no practical max.
emptynoneTrue when the stack is empty.
is_damageablenoneTrue when the item can take durability damage.
enchantablenoneTrue when the item can be enchanted.
durabilitymin, maxTests remaining durability points.
relative_durabilitymin, maxTests remaining durability fraction from 0 to 1; non-damageable items read as 1.
ingredientitem, tagTests an item id or item tag. tag takes priority.
foodnoneTrue when the item is food.
fireproofnoneTrue when the item is fire resistant.
enchantmentenchantment, minTests an enchantment level; without enchantment, tests whether the stack is enchanted at all. min defaults to 1.
base_enchantmentenchantment, minAlias-style enchantment check.
andconditionsTrue when every child item condition passes.
orconditionsTrue when any child item condition passes.
constantvalueAlways returns value; defaults to true.

pheno:actor_condition, pheno:target_condition, pheno:both, pheno:either, pheno:invert, pheno:undirected, pheno:distance, pheno:relative_rotation, pheno:collection_contains, pheno:collection_count, pheno:compare_dimensions, pheno:compare_scales

Bi-entity conditions test an actor and a target.

These take no fields beyond type.

TypeTrue When
pheno:attack_targetThe actor is a mob whose current attack target is the target.
pheno:attackerThe actor’s last hurt-by mob is the target.
pheno:can_seeThe actor has line of sight to the target.
pheno:equalActor and target are the same entity.
pheno:ownerThe actor is ownable and its owner is the target.
pheno:prime_adversaryThe target’s kill credit entity is the actor.
pheno:ridingThe actor is directly riding the target.
pheno:riding_rootThe actor’s root vehicle is the target.
pheno:riding_recursiveThe target appears anywhere in the actor’s vehicle chain.
TypeFieldsDescription
pheno:distancemin, maxTrue when actor-target distance is within the range. Defaults: min: 0, no practical max.
pheno:relative_rotationmax_angleTrue when the target is within max_angle degrees of the actor’s look direction. Defaults to 90.

These run an entity condition against one or both entities.

TypeFieldDescription
pheno:actor_conditionconditionApplies the condition to the actor.
pheno:target_conditionconditionApplies the condition to the target.
pheno:bothconditionTrue when the condition passes for both actor and target.
pheno:eitherconditionTrue when the condition passes for either actor or target.

Directional wrappers take a nested bi-entity condition:

TypeDescription
pheno:invertSwaps actor and target before testing the inner condition.
pheno:undirectedTests the inner condition both ways and passes if either direction passes.
TypeFieldsDescription
pheno:compare_dimensionswhich, comparisonCompares actor bounding-box size against target size. which is width, height, or both; default both.
pheno:compare_scaleswhich, comparisonCompares actor scale against target scale. which is width, height, or both; default both.
pheno:collection_containscollectionTrue when the target is present in the actor’s collection store.
pheno:collection_countcollection, comparison, compare_toCompares the target’s tally in the actor’s collection. Defaults: comparison: >=, compare_to: 1.