Performance

All mod logic runs during the server tick, 20 times per second. Most steps and value nodes cost almost nothing, but block and entity searches add up quickly when run inside repeating events. The Problems pane flags common performance pitfalls automatically.

Searches

Block is (when Within is above 0), Count nearby, and For each nearby scan a cubic box extending Within blocks from the center position in every direction. A radius of 8 scans a 17x17x17 volume, so larger boxes get expensive quickly.

Keep Within as small as your feature allows.

Repeating flows

Every N ticks, Every N ticks for mobs, and Every N ticks for blocks run once per online player, loaded mob, or placed block every Ticks ticks. When player steps on block and When mob steps on block run every single tick while an entity stands on a matching block. Any function called from these events repeats at the same rate.

  • Keep Ticks as high as your mechanic allows (20 ticks = 1 second).
  • Use 10 or more Ticks on any interval event that performs a search; shorter intervals trigger a warning.
  • In step-on events, guard searches behind a cheap If check first.
  • Specify Mobs on Every N ticks for mobs whenever possible; leaving it empty runs the flow for every loaded mob and animal.
  • Set For players on Every N ticks when an effect requires holding or wearing an item, so other players skip the flow immediately.

Blocks that affect nearby players

For blocks like beacons or healing totems, start from Every N ticks for blocks (listing your block) and find players with For each nearby. That way, only blocks actually placed in the world perform a search. Scanning around every player with Every N ticks and Block is checks around every online player even when none of your blocks are nearby, and triggers a warning.

Put cheap checks first

An If node skips its downstream steps whenever its condition is false, so checking a fast condition before a search avoids unnecessary work. Fast checks read a single value directly: Is holding, Is sneaking, World is, Entity is, Random chance, Health, Counter, or Block is with Within set to 0.

And evaluates A first and skips B when A is false; Or skips B when A is true. Wire the fast check into A and put the search or Looked-at block in B. Putting the search in A triggers a warning.

Compute expensive values once

Value nodes recalculate each time an input wire reads them. If a search, Looked-at block, Java code value, or function output feeds three inputs, it runs three times. Wire it into Keep value in the flow beforehand and connect those inputs to Keep value so it only runs once. Repeating an expensive calculation inside a recurring flow triggers a warning.

Java code

Java code runs synchronously on the server thread. Keep loops short, scan as few blocks and entities as needed, and never sleep or block inside a method.