Minecraft mod events and flow
Every interactive feature starts with an event. Wires from its then port run steps in sequence, with each step’s then leading to the next. All logic runs on the server.
Steps
Each flow output connects to a single step (connecting a new wire replaces the existing one). Chain sequential actions directly from one step’s then port into the next step’s input.
Sequence runs multiple flow branches one after another from then 1 to then 2 (up to 12 steps), finishing each branch’s chain before starting the next. Use it when you want to run several independent If checks, continue unconditionally after If, Switch, or Wait, or organize distinct phases of an event.
If checks its condition and continues through either true or false.
Switch compares a rounded whole number against exact cases or inclusive Value to To ranges and falls back to otherwise. Weighted branch picks one output at random in proportion to each row’s Weight (plus an optional Otherwise weight). Loot table and Roll loot define weighted or independent item drops and run each for every rolled stack.
For each nearby runs the steps after each once for every player or mob inside a box extending Within blocks from its position in every direction, then continues once from then after the loop finishes. Wire its Player (or Entity) output into steps after each to act on each target; that output is only available inside the each branch. Enable Exclude one to skip the entity wired into Excluded (or the event’s own player or mob when left unwired).
Set Pick to run the steps for just one of them. Nearest picks the one closest to the position. Looked at picks the one the Player is looking at within Within blocks, not hidden behind a block, which suits wands and targeting spells. If nothing matches, the each branch is skipped and then still runs.
Count nearby returns how many players or mobs are inside that same box. Use it when a step should run once based on crowd size, such as sending a warning when players gather. When counting players, the triggering player is included.
Run order
The Run order pane shows a live outline of how events, conditions, loops, and functions run at runtime without leaving the canvas. Open it from the Run order button in the editor toolbar, the Run order button inside a selected event or flow node’s inspector, or Toggle Run order and Float Run order in window in the command palette. Use the pop-out icon in the header to move it into a floating window.
Switch between two scopes at the top of the pane:
- This listener traces a single event node or function from its root, following your canvas selection unless you pin a specific entry from the dropdown.
- Whole event groups every listener registered on the same Minecraft game event in their runtime order, showing priority and cancellation flow.
The outline walks branches in execution order across Sequence, If, Switch, loops, Wait delays, and Call function steps. When exclusive branches rejoin cleanly into a shared continuation, those steps appear once below the branches (Continues below). When paths merge across partial branches, loops, or Wait boundaries, the shared block is listed once under Shared steps and referenced by clickable jump rows that scroll to and highlight the target block. Hovering any step highlights its node on the canvas, and clicking selects and focuses that node.
Waiting
Wait runs the steps after it once Seconds have passed, while the rest of the game goes on. For example, to explode a block three seconds after it is placed, run Wait from When block is placed, then Explode.
The steps after a Wait read their values when they run, not when the event happened: Player position gives where the player is by then. To use a value from the moment of the event, pass it through Keep value before the Wait. Cancel event and Change damage can’t run after a Wait, since the event is over by then. If the player has left the game before the wait ends, steps that act on them may not run. Enable Survive server restart to save the remaining time and captured context across world reloads instead of dropping the timer (persistent waits cannot be used inside functions).
Values
Value wires pass a player, entity, world, position, number, boolean (true or false), item, or block into an input. A single output can feed multiple inputs.
Select outputs Then when If is true, and Else otherwise. Its output type matches whatever you wire into it.
Values are recalculated each time an input reads them. Wiring Random chance into two If nodes rolls twice, and reading Health after Heal reflects the updated health. To compute a value once and share it across several steps, place Keep value in the flow beforehand: it captures the input value as the flow passes through, and every wire from it reads that saved result.
You can also wire a Player or Entity output directly into a Position input. This uses the block coordinates at their feet (just like Player position) and labels the input accordingly, such as Position of Player from When item is used. Like any other value wire, it is evaluated each time a step reads it; to capture where a player stood before Teleport moves them, pass the player through Keep value first.
Unwired inputs
| Input | Default when unwired |
|---|---|
| Player | The event’s player |
| Entity | The event’s entity, or its player if there is no separate entity |
| World | The event’s world |
| Position | The event’s position output, such as Killed entity position or Block position |
| Number | The number set on the node |
If an event has no position of its own (such as When item is used), wire a Position into the step, such as the event’s Player output to use the player’s current position.
Inside a function, unwired inputs default to the function’s own input of that type.
Mob filters
Leaving an event’s Mobs list empty makes it run for every mob, animal, and player. (When mob steps on block always excludes players.)
When mob senses vibration runs only for custom mobs in this mod (Java Edition only). When Mobs is empty, every custom mob listens with at least a 16-block vibration range.
Ticks
There are 20 ticks in one second.
Every N ticks runs once for each online player every Ticks ticks. When For players is set, it runs only for players holding or wearing one of the listed Items (armor must be equipped in its matching armor slot). Keep Ticks as high as your feature allows, and see Performance for tips on keeping tick logic fast.
Every N ticks for mobs works the same way for every loaded mob and animal, or only the types listed in Mobs.
Every N ticks for blocks runs for each placed block from Blocks in loaded chunks, providing its Block position. Use it for beacons, generators, and blocks that heal or damage nearby players. On Java Edition, blocks only begin ticking once placed, so naturally generated blocks like ores and trees won’t tick. Vanilla ticking blocks such as buttons, pressure plates, doors, leaves, and falling blocks like sand manage their own ticks and cannot be listed here.
When player steps on block runs every tick while a player stands on one of its Blocks, and When mob steps on block does the same for mobs and animals. Because these run every tick, keep their steps lightweight; see Performance for details.
Jumping, sleeping, and chat
When player jumps runs when a player leaves the ground. Pressing jump again in mid-air isn’t detected, so it cannot be used for double jumps.
When player falls asleep runs once when a player gets into bed. When player wakes up runs whenever they leave the bed, whether morning has arrived or they got up early. To grant a reward only after a full night’s sleep, check World is day afterward.
When player chats runs when a chat message matches Contains (case-insensitive), or on every message when Contains is empty. Cancel event suppresses the message. This event isn’t available on Bedrock Edition.
Picking up and dropping items
When player picks up item runs when a player picks up one of the listed Items from the ground, or any item if none are listed. When player drops item runs when a player tosses one of the listed Items from their inventory (or any item if none are listed). Player position is where the player stands, and neither event can be canceled.
Changing dimensions
When player changes dimension runs when a player arrives in another dimension through a portal or teleport, matching either a chosen To dimension or any dimension. World and Player position give their arrival location. On Java Edition, leaving the End through the exit portal and respawning after death count as respawning rather than changing dimensions, so this event does not run.
Sneaking
When player sneaks runs once when a player starts sneaking, rather than repeating while they hold the key. Use Is sneaking to check whether they are currently sneaking.
Left-clicking blocks
When block is left-clicked runs when a player starts hitting one of the listed Blocks, in both survival and creative. It can run again while they keep hitting a block that doesn’t break. On Java Edition it runs before the block breaks, and on Bedrock Edition after the hit. To run something when the block breaks, use When block is broken.
Keys
When key is pressed adds a key to the game’s Controls screen, listed under your mod’s name as its Name. Key is the key it starts on, chosen from keys Minecraft leaves free, and each player can rebind it in Controls. It runs once per press, for the player who pressed it, and holding the key doesn’t repeat it. Give each key node a different Name and Key. For an ability with a wait between uses, check Is on cooldown first, then run Start cooldown after it.
Bedrock Edition has no custom keys, so the node isn’t available there. Use When player sneaks or When player jumps instead.
Crafting and levels
When player crafts item runs when a player takes a crafted item from a crafting table or inventory crafting grid, matching either the listed Items or any item when the list is empty. This event isn’t available on Bedrock Edition.
When player levels up runs when a player’s experience level increases, with Level reached providing their new level. Gaining multiple levels in a single tick (for example, from /xp) triggers the event once.
Names and game modes
Set name gives an entity a name, shown when a player looks at it, as with a name tag. An empty Name removes it. On Java Edition players keep their own names; on Bedrock Edition the name replaces the one above the player’s head.
Set game mode switches a player to survival, creative, adventure, or spectator mode. Entity is with Check set to game mode returns true when the entity is a player in the chosen Game mode (for example, check survival so that players in creative mode are left out).
Taking items
Take item removes up to Count matching Items from a player’s inventory (including equipped armor), or removes as many as they have if they carry fewer. Item count returns how many matching items the player is carrying. To build a shop or require an item cost, compare Item count with Compare first, then run Take item and grant the reward.
Clear inventory removes every item a player carries, including armor and the offhand.
Tags
Tag entity adds a tag to an entity, or removes it, and Entity is with Tagged checks for it. A tag is a word of lowercase letters, digits and underscores. Tags stay on the entity when the world is saved, and the /tag command sees them. Use them to mark mobs a player has already rewarded, or players who have joined a team.
Riding
Ride with Mount puts Rider on Vehicle, the way a saddle or boat would. Dismount takes the rider off whatever it is riding. Entity is with Riding checks the rider, and with Ridden checks the vehicle. On Bedrock Edition, only mobs that can carry a rider (horses, pigs, striders, boats, and minecarts) accept one.
Entity is with Tamed checks for a pet or mount a player has tamed, such as a wolf, cat, parrot or horse. In lava checks for an entity standing in lava.
Set on fire with Seconds at 0 puts the fire out. Explode with Sets fire lights fires around the blast. Time of day with Which set to day gives the days passed, 0 on the first day.
Showing counters
Display counter shows every player’s score of a player counter to everyone: on the Sidebar, in the Player list (the Tab list), or Below name under each player’s name. Title is the heading the sidebar shows. Change counter with the same Counter name changes the numbers it shows. Hide clears that place. Variables can’t be shown this way, so keep a number you want on screen in a counter.
Players online counts every player on the server, in every dimension.
{value} in chat.Numbers and names in messages
Send message and Show title have a Value input. Write {value} in Text (or Title) where the number should appear, for example Coins: {value}. Whole numbers show without decimals and other numbers are shown to up to two decimal places. If the text has no {value}, the number is added at the end.
Write {player} for a player’s name, for example Welcome, {player}!. It shows the name of the player the message or title goes to. A message or title to everyone shows the name of the event’s player.
{player} and {value} at runtime.Pulling items
Pull items moves every dropped item within Radius blocks onto a position. A player standing there picks them up after the usual pickup delay. To build a magnet, run it from Every N ticks at the player’s position.
Particle lines
Spawn particles scatters Count particles around Position. Wire a second position into Line to to spread them evenly along the line between the two instead, such as a beam from a player to the block they’re looking at.
Variables and counters
A Variable node stores a number or a boolean (true_or_false) per player or for the whole world, saved with the world. Set variable adds to or sets a number variable, or updates a boolean variable, and Variable value reads it.
Change counter and Counter update and read a whole-number scoreboard objective (<mod_id>.<counter>), which commands can also inspect.
Mod config
A Config option defines a configurable whole number, decimal, or true/false setting saved in <configDir>/<mod_id>.toml on Java Edition, with minimum/maximum clamping and an optional comment line. Wire Config value into any matching number or boolean input to use that setting in your flow. On Bedrock Edition, config options warn and always use their default value.
Custom commands
When command is run registers /<command> (or /<mod_id>:<command> on Bedrock Edition). Each row in Arguments adds a required parameter and a matching output port on the node. Run command executes a vanilla command string as the world or as a player while hiding its chat output.
Advancements and enchantments
Grant advancement awards one of your mod’s Advancement nodes to a player (use Earned by set to granted for advancements triggered only by your flow). Enchantment level returns the level of a custom Enchantment on a player’s held or worn item, or 0 when absent.
Fishing, villager trades, advancements, and redstone
Four Java Edition events let flows react to progression and world signals: When player fishes (when a catch is reeled in), When player trades (when a villager or wandering trader exchange finishes), When player earns advancement (either a specific advancement or any advancement with a toast), and When redstone changes (whenever neighboring redstone signal updates on any of the listed custom blocks).
Functions
A function is a reusable canvas with its own input and output ports. Inside a function, flow starts at Input and ends at Output; Call function runs it from an event or another function.
Custom sounds and music discs
A Sound node defines a custom sound event in .ogg Vorbis format (up to 1 MB). Leave Audio (.ogg) empty to use the built-in chime fallback, set Subtitle for accessible captions, and turn on Stream for long music tracks so audio streams from disk rather than loading all at once.
Point Play sound’s Custom sound property at a Sound node to play your custom audio in an event flow.
To add a playable record, create an Item with type Music disc, pick your Sound node, and set the song title, length in seconds, and redstone comparator output. Other specialized gear item types include Elytra (with configurable durability, repair item, and 64x32 worn wings texture on Java 1.21.2+), Trident, and customizable Bow and Crossbow items (custom ammo item, draw time, and shot speed).
Widget animation
A Widget animation node adds smooth client-side hover scaling and optional vertical lift to buttons and clickable widgets across Minecraft’s built-in screens (title screen, pause menu, options, multiplayer, world select) and modded screens. Choose whether it targets Clickable widgets (buttons, sliders, and tabs while skipping text boxes and labels), Buttons only, or All widgets, and tune Hover scale, Duration (ms), Easing (ease_out, ease_in_out, linear, or spring), Hover Y offset (px), and Active widgets only. This node is available on Java Edition only.
Set use delay
Set use delay adjusts a player’s client-side right-click block placement and item use repeat delay (0 to 40 ticks, where 4 is vanilla, 0 removes the delay for fast placement, and 2 gives a 0.1 second delay). Turn on Blocks only to apply the delay only while the player is holding a block item, or wire a number into Ticks to switch between modes dynamically from keybinds or variables. This action is available on Java Edition only.