Hubs & Standard Library
Hubs (hub(name))
Section titled “Hubs (hub(name))”A PLC must join a Hub via the Hub’s Members tab on the same cable segment before referencing it.
Limits per Hub
Section titled “Limits per Hub”| Resource | Limit |
|---|---|
| Shared Registers | 32 |
| Shared Channels | 8 |
| Register types | bool, int, float, string |
| Channel capacity | Equivalent to a Tier 3 resource buffer |
Methods on Hub
Section titled “Methods on Hub”| Method | Signature | Description |
|---|---|---|
H.register |
H.register(name: string) -> HubRegister |
Selects a pre-declared register on the Hub. Faults if not declared in the Hub UI. |
H.channel |
H.channel(name: string) -> Point |
Selects a pre-declared shared buffer channel on the Hub. |
HubRegister methods
Section titled “HubRegister methods”HR.get()— returns the current committed value (or a write staged earlier in this same scan).HR.set(value)— stages a write matching the register’s declared type. Committed after local registers and beforemove(). If several PLCs write to the same Hub register in one tick, the last committer wins in scan order.- Stopping, waiting, or faulting does not reset Hub registers.
Hub Channel (Point) rules
Section titled “Hub Channel (Point) rules”- Valid as
srcordstinmove()with any same-kindPointorGroup. - Supports standard resource readings (
count(),contents(),available(),space()). - Has no side views and is never included in
points(...)wildcard groups. - Multiple consumer PLCs draw from committed stock in scan order.
Standard Library: mplc:timers
Section titled “Standard Library: mplc:timers”Import timer helpers at the top of your script:
load("mplc:timers", "on_delay", "off_delay", "pulse")All three timers measure elapsed time in game ticks via now() (20 ticks = 1 second). Precision matches the PLC’s scan interval because inputs are only observed when a scan runs.
Timer state register
Section titled “Timer state register”Pass each independent timer its own local register declared as:
TIMER_REG = register("timer_reg", [-1, False])The register stores [phase_start_tick, previous_input] (-1 when idle). Never share one state register between two timers.
on_delay(reg, input, ticks) -> bool
Section titled “on_delay(reg, input, ticks) -> bool”Returns True once input has remained True continuously for at least ticks game ticks, staying True until input becomes False.
reg(Register[list]) — timer state register initialized to[-1, False].input(bool) — current condition.ticks(int) — delay in ticks (<= 0passesinputthrough immediately).- Restart note: Stopping the PLC preserves
reg. To repeat a full delay after recovery,on_delaymust observeinput == Falseon a running scan first.
off_delay(reg, input, ticks) -> bool
Section titled “off_delay(reg, input, ticks) -> bool”Returns True immediately while input is True, and continues returning True for ticks game ticks after input turns False.
reg(Register[list]) — timer state register initialized to[-1, False].input(bool) — current condition.ticks(int) — hold time in ticks (<= 0followsinputimmediately).
pulse(reg, trigger, ticks) -> bool
Section titled “pulse(reg, trigger, ticks) -> bool”Returns True for ticks game ticks on a rising edge (trigger changing from False to True), even if trigger returns to False during the pulse.
reg(Register[list]) — timer state register initialized to[-1, False].trigger(bool) — trigger signal; must return toFalsebefore a new pulse can start.ticks(int) — pulse duration in ticks (<= 0disables output and returnsFalse).
Not an official Minecraft website. Not approved by or associated with Mojang or Microsoft.