Skip to content

Actions

Actions change the world, an entity, an item, a block, or the current Pheno context. They run against the actor, target, block, or item provided by the surrounding system and any wrappers around the action. For how Pheno decides the current actor, target, block, or item, see Context.

FamilyRegistered Types
Context wrapperspheno:actor_action, pheno:target_action, pheno:invert, pheno:block_action, pheno:equipped_item_action, pheno:at
Control flowpheno:and, pheno:chance, pheno:choice, pheno:delay, pheno:if_else, pheno:if_else_list, pheno:if_bientity, pheno:nothing, pheno:side
Entity effectspheno:apply_effect, pheno:clear_effect, pheno:heal, pheno:damage, pheno:ignite, pheno:extinguish, pheno:freeze, pheno:exhaust, pheno:feed, pheno:add_xp, pheno:gain_air, pheno:set_fall_distance, pheno:set_no_gravity
Movement and areapheno:add_velocity, pheno:jump, pheno:random_teleport, pheno:area_of_effect, pheno:mount, pheno:dismount, pheno:passenger_action, pheno:riding_action
Inventory and itemspheno:give, pheno:drop_inventory, pheno:consume, pheno:cooldown, pheno:item_cooldown, pheno:holder_action, pheno:remove_enchantment, pheno:spawn_item
World effectspheno:play_sound, pheno:spawn_particles, pheno:spawn_entity, pheno:explode, pheno:emit_game_event, pheno:beam, pheno:cloud, pheno:execute_command
Resources and collectionspheno:change_resource, pheno:resource_transfer, pheno:change_collection, pheno:for_each
Relationship and mobspheno:tame, pheno:set_in_love, pheno:zombify_villager
Block action aliasespheno:set_block, pheno:add_block, pheno:destroy, pheno:bonemeal, pheno:modify_block_state, pheno:schedule_tick, pheno:offset, pheno:area_of_effect
Projectiles and animationpheno:fire_projectile, pheno:swing_hand

An action object can include on to run that action once per selected entity. A bare JSON array of actions runs each action in order.

Entity, item, and block actions each have their own on support. For the exact actor/target/origin, holder, and cause behaviour, use the Context reference.

TypeFieldsDescription
pheno:actor_actionactionRuns the nested action on the current actor. Mainly useful for symmetry with bi-entity flows.
pheno:target_actionactionRuns the nested action on other, with actor and target swapped. No-op without other.
pheno:invertactionRuns the nested bi-entity action with actor and target swapped. No-op without other.
pheno:block_actionblock_actionRuns a block action at the actor’s block position, with the actor as cause. Server-side only.
pheno:atblocks, doSelects block positions from the entity context and runs a block action at each. blocks is a block selector; do is a block action. Server-side only.
pheno:equipped_item_actionslot, item_actionRuns an item action on the actor’s equipped item. slot defaults to mainhand; valid slots include mainhand, offhand, head, chest, legs, and feet.
TypeFieldsDescription
pheno:andactionsRuns every nested action in order. A bare JSON array does the same thing.
pheno:chancechance, actionRuns the nested action with the given probability. chance defaults to 1.
pheno:choiceactionsPicks exactly one weighted entry. Each entry is { "action": {...}, "weight": N }; weight defaults to 1 and is clamped to at least 1.
pheno:delayticks, actionSchedules the nested action after ticks server ticks. ticks defaults to 0 and is clamped to at least 0; the action is skipped if the actor is gone.
pheno:if_elsecondition, if_action, else_actionTests an entity condition on the actor, then runs if_action or optional else_action.
pheno:if_else_listactions, fallback_actionRuns the first branch whose entity condition passes. Each branch is { "condition": {...}, "action": {...} }; fallback_action is optional.
pheno:if_bientitycondition, if_action, else_actionTests a bi-entity condition against actor and other. Without other, the condition fails and optional else_action may run.
pheno:nothingnoneExplicit no-op.
pheno:sideside, actionRuns the nested action only for server; client is a no-op because Townstead powers run server-side. side defaults to server.
TypeFieldsDescription
pheno:apply_effecteffect, duration, amplifierApplies a status effect. Defaults: duration: 200, amplifier: 0.
pheno:clear_effecteffectRemoves one status effect, or all active effects if effect is omitted.
pheno:healamountHeals by a Pheno value amount. Required; only positive evaluated values do anything.
pheno:damageamountDeals generic damage by a Pheno value amount. Required; only positive evaluated values do anything.
pheno:ignitesecondsSets the actor on fire. seconds defaults to 3 and is clamped to at least 1.
pheno:extinguishnoneClears the actor’s fire.
pheno:freezeamountAdds frozen ticks, capped just beyond the freeze threshold. amount defaults to 5 and is clamped to at least 1.
pheno:exhaustamountPlayer-only. Adds hunger exhaustion. amount defaults to 0.5 and is clamped to at least 0.
pheno:feedfood, saturationPlayer-only. Restores hunger and saturation. Defaults: food: 1, saturation: 1.0.
pheno:add_xppoints, levelsPlayer-only. Adds raw experience points, whole levels, or both. At least one value must be non-zero.
pheno:gain_airairChanges air supply by ticks, clamped to max air. Negative values drain air; 0 is rejected.
pheno:set_fall_distancefall_distanceSets pending fall distance. Defaults to 0.
pheno:set_no_gravitygravitySets no-gravity to the inverse of gravity. Default gravity: false disables gravity.
TypeFieldsDescription
pheno:add_velocityx, y, z, relativeAdds velocity. Coordinates default to 0; with relative: true, the vector is rotated to the actor’s facing and z is forward.
pheno:jumpstrengthSets upward velocity using vanilla jump power plus Jump Boost. strength defaults to 1.0; works in mid-air and resets fall distance.
pheno:random_teleportdistanceAttempts a random safe teleport within distance blocks. Default 8, clamped to at least 1.
pheno:area_of_effectradius, include_self, actionRuns an entity action on every living entity within radius of the actor. radius defaults to 4 and is clamped to at least 0; include_self defaults to false. Each target becomes the inner action’s actor, with the original actor as other.
pheno:mountnoneActor starts riding other. Server-side; no-op without other.
pheno:dismountnoneActor stops riding.
pheno:passenger_actionactionRuns an entity action on each living passenger riding the actor.
pheno:riding_actionactionRuns an entity action on the living vehicle the actor is riding.
pheno:tamenoneIf the actor is a player and other is an untamed tamable animal, tames other. Server-side only.
pheno:set_in_lovenoneIf other is an animal, puts it in love mode. A player actor is credited as the cause.
pheno:zombify_villagernoneConverts a mob actor into a vanilla zombie villager. Server-side only.
TypeFieldsDescription
pheno:giveitem, countPlayer-only. Gives an item stack; overflow drops at the player’s feet. count defaults to 1 and is clamped to at least 1.
pheno:drop_inventorynonePlayer-only. Drops the actor’s entire inventory.
pheno:spawn_itemitem, amountSpawns an item stack at the actor’s position. amount defaults to 1 and is clamped to at least 1; server-side only.
pheno:item_cooldownitem, cooldownPlayer-only. Puts a named item on cooldown. cooldown defaults to 20 ticks.

Item actions run inside an item context, usually through pheno:equipped_item_action. A JSON array of item actions runs each action in order, and an item action object can include on to select stacks from the holder.

Item Action TypeFieldsDescription
pheno:consumeamountShrinks the stack. amount defaults to 1 and is clamped to at least 1.
pheno:cooldowncooldownPlayer-holder only. Puts the current stack’s item on cooldown. Defaults to 20 ticks.
pheno:damageamountAdds durability damage. Negative values repair; breaking damage shrinks the stack by one.
pheno:holder_actionactionRuns an entity action on the stack holder. No-op without a holder.
pheno:remove_enchantmentenchantmentRemoves one enchantment from the stack.
pheno:change_collectioncollection, operation, time_limitItem-domain collection action. Adds, removes, or clears the contextual stack’s item in a collection on the holder.
TypeFieldsDescription
pheno:play_soundsound, sounds, volume, pitch, categoryPlays a sound at the actor. Supports a single sound spec or weighted sounds; category defaults to neutral.
pheno:spawn_particlesparticle, count, spread, speedEmits simple particles at the actor. Defaults: count: 8, spread: 0.4, speed: 0; server-side only.
pheno:spawn_entityentitySpawns an entity at the actor’s position. Server-side only.
pheno:explodepower, fire, destroyExplodes at the actor, credited to the actor. Defaults: power: 2.0, fire: false, destroy: true.
pheno:emit_game_eventeventEmits a vanilla game event from the actor. Server-side only.
pheno:beamray fields, particle, spacingDraws simple particles along a ray from the actor’s eyes to the ray impact point. spacing defaults to 0.5 and is clamped to at least 0.05.
pheno:clouddo, where, radius, duration, particle, grow_per_tick, shrink_on_use, wait_time, reapply_delay, heightSpawns a lingering field at the actor that repeatedly runs do on entities inside it. where is an optional bi-entity condition. Defaults: radius: 3, duration: 600, wait_time: 10, reapply_delay: 20, growth/shrink/height 0.
pheno:execute_commandcommandRuns a command as the actor from a silent permission-level-2 source.
pheno:fire_projectileentity, speed, inaccuracyLaunches a projectile along the actor’s look vector. Defaults: entity: minecraft:arrow, speed: 1.5, inaccuracy: 1.0; server-side only.
pheno:swing_handhandPlays a hand-swing animation. hand is main or off; default main.
TypeFieldsDescription
pheno:change_resourceresource, amount, operationChanges a resource gene value. amount is a Pheno value and defaults to 0; operation is add, subtract, or set, default add. Values are clamped by the resource.
pheno:resource_transferfrom, to, amountTransfers up to amount from one resource gene to another. Only the amount actually drained is added to to; amount must be positive.
pheno:change_collectioncollection, operation, amount, key, time_limitEntity-domain collection action. Adds, removes, sets, or clears entries in the actor’s collection. Without key, the contextual other is used. time_limit is an optional TTL in ticks.
pheno:for_eachin, do, action, where, limit, orderIterates living entity members of a collection. The holder remains actor and the member becomes other; where can gate each pair. order is oldest_first or newest_first; limit <= 0 means no cap.

Block actions run in a block context, usually through pheno:block_action or pheno:at. A JSON array of block actions runs each action in order, and a block action object can include on to select more block positions from the current block context.

Block Action TypeFieldsDescription
pheno:set_blockblockReplaces the target block with the given block’s default state.
pheno:add_blockblockPlaces the block only if the current block can be replaced.
pheno:destroydrop_itemDestroys the target block. drop_item defaults to true; the cause entity is credited if present.
pheno:bonemealnoneApplies bonemeal behaviour if the target block supports it.
pheno:modify_block_stateproperty, value, operationSets a block-state property, or cycles it with operation: cycle. No-op if the property or value is invalid.
pheno:schedule_tickdelaySchedules a block tick for the target block. delay defaults to 1; no-op on air.
pheno:offsetx, y, z, block_actionRuns a nested block action at an offset position. Offsets default to 0.
pheno:area_of_effectradius, shape, block_condition, block_actionRuns a nested block action across a cube or sphere. radius defaults to 1 and is capped at 16; shape defaults to cube; block_condition is optional.
pheno:execute_commandcommandBlock-domain command action. Runs a command from a silent permission-level-2 source positioned at the block.
pheno:explodepower, fire, destroyBlock-domain explosion at the block centre. Defaults: power: 2.0, fire: false, destroy: true.
pheno:spawn_entityentityBlock-domain entity spawn centered on the block.
pheno:change_collectioncollection, operation, time_limitBlock-domain collection action. Adds, removes, or clears the contextual block position in a collection on the cause entity.