Skip to content

The Scan Cycle & Commits

If you have used other Minecraft computer mods, you might expect a script to run forever in an infinite while True: loop with sleep(1) calls in the middle. MPLC works differently on purpose, following how real industrial PLCs operate.

Every time a PLC’s scan timer fires, it goes through three clean phases:

  1. Check readiness: Verify the PLC has enough FE for its clock charge and that every Interface, Hub, and World Card box it depends on is connected and in a ticking chunk. If anything is missing, pause in Waiting without running the script.
  2. Run scan() (staging): Your script reads inventories, checks redstone, updates registers, and schedules calls like move(), set(), dig(), and use(). Nothing changes in the world yet—instead, MPLC records your planned actions and updates its internal plan so later count() calls in the same scan reflect what you already promised to move.
  3. Commit: Once scan() returns cleanly, MPLC applies everything in a fixed order:
    1. Save local registers
    2. Save Hub registers
    3. Execute move() transfers (including World Item/Fluid placements and drops)
    4. Apply control outputs (Redstone set(), World Sensor dig() and use())
    5. Notify neighboring blocks
  • Half-finished crashes cannot corrupt your base: If your script hits a bug or runs out of steps halfway through scan(), every staged write and move is discarded. Nothing gets half-transferred or stuck halfway through an update.
  • No server-freezing infinite loops: Because while, recursion, and sleep() do not exist in Starlark, a typo can never hang a multiplayer server or lock up a chunk.
  • Dry Run is exact: Because scans stage their intentions before touching the world, Dry run can execute the exact same scan against live inventories and show you the planned effects without changing a single item.
  • No accidental duplication or invisible mid-scan hops: Items planned to arrive at chest B cannot be forwarded out of B in the same scan. Wait until the next scan so B really holds the items before moving them onward.

Between planning a move() and actually inserting into a modded machine at commit time, another hopper, pipe, or player might fill a slot—or a machine might refuse a particular item variant.

When that happens, MPLC simply delivers whatever fits and leaves the rest safely in the source block (or returns it to the source’s input buffer). A short delivery never faults your PLC; your script checks real stock again on the next scan.

Not an official Minecraft website. Not approved by or associated with Mojang or Microsoft.