Skip to content

Built-in Functions

All built-in functions below are available globally without load().


Returns a Point handle for one bound Interface expansion.

point(ref: string) -> Point
  • ref — "interface_name/suffix". Both parts are required even if the Interface has only one card.
    • Resource suffixes: item, fluid, energy
    • Control suffixes: redstone, world
  • Constructing the handle at top level does not read the world. The handle resolves by name on each scan; missing or duplicate bound interface names fault when used.

Returns a Group matching all bound Interfaces whose names match a wildcard pattern.

points(pattern: string) -> Group
  • pattern — "name_pattern/suffix". The interface name part must contain at least one *; the suffix must be literal (no wildcard in the suffix).
  • Membership is fixed for the duration of one scan and sorted in natural name order (furnace_2 before furnace_10).
  • An empty group has zero stock and plans no moves (does not fault).

Declares a persistent local Register saved on the PLC across scans, world reloads, and breaking/placing the block.

register(name: string, default: any) -> Register
  • Must be called directly at the main program’s top level (forbidden inside load() modules or inside scan()).
  • name — unique string identifier for this PLC.
  • default — any non-None value (bool, int, float, string, list, tuple, set, or dict). Fixes the register’s outer type.
  • Uploading a new program with the same register name and type preserves its saved value even if default changed. Changing the type resets it to the new default; omitting the declaration deletes the register.
  • reg.get() — returns the current value (immutable; includes any .set() staged earlier in the same scan).
  • reg.set(value) — stages a replacement value matching the register’s declared type. Written at commit; discarded if the scan faults before commit.

Returns a handle for a Hub that this PLC has joined on its cable segment.

hub(name: string) -> Hub
  • name — exact lowercase hub name configured in the Hub screen.
  • Missing or ambiguous hub names fault when a register or channel on the hub is used.
  • See Hubs & Standard Library for .register() and .channel().

move(src, dst, n=None, *, key=None, **options)

Section titled “move(src, dst, n=None, *, key=None, **options)”

Schedules a resource transfer at commit time and returns the planned amount (int).

move(src: Point | Group, dst: Point | Group, n: int | None = None, *, key: string | None = None, **options) -> int
  • src, dst — Point or Group of the same resource kind (item, fluid, or energy).
  • n (optional, positional or keyword) — maximum total amount to move (in items, mB, or FE). Omit to move as much as remaining transfer allowances permit. On a Group, n caps the whole call, not each member.
  • key (keyword-only) — resource ID ("minecraft:coal") or #tag ("#minecraft:logs"). Omit to consider any resource. Forbidden on keyless kinds (energy).
  • **options (keyword-only) — destination card options:
    • World Item Card: at=(x, y, z), mode="place" (default) or mode="drop".
    • World Fluid Card: at=(x, y, z).
    • Unknown options fault and name the offending option.
  • Return value: planned amount, not guaranteed delivered amount. Short deliveries at commit do not fault.
  • Each planned move leg charges 80 steps plus I/O units.

Imports public top-level symbols from a Programmer library module or a built-in mplc: module.

load("mplc:timers", "on_delay", "off_delay")
load("my_lib", "TARGET", helper="top_up")
  • Must appear at the top of the file before other statements.
  • Bare names ("my_lib") load case-sensitive entries from the uploading Programmer’s library.
  • mplc: names load built-in modules (currently mplc:timers).
  • Names starting with _ are private and cannot be imported. Imported names are not re-exported by a module. Cycles are rejected.

Returns the current game tick (int).

now() -> int
  • Use now() for elapsed time calculations (20 ticks = 1 second) rather than counting scans.

Appends a formatted line to the PLC’s log (also displayed in Dry run results).

print(*args, sep: string = " ") -> None

Immediately aborts the current scan with an error message, discards all staged writes and moves, and places the PLC in Fault mode.

fail(*args, sep: string = " ") -> never
  • Use return for normal idle/skip conditions; reserve fail() for unexpected invariant violations you want surfaced on the PLC screen.

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