Redstone & Timers
Install a
Redstone Expansion on an Interface to read redstone strength (0–15) or emit a controlled redstone signal into a block, lamp, piston, or modded machine.
Input vs. Output mode
Section titled “Input vs. Output mode”Open the Interface screen, select the Redstone tab, and choose its Direction:
- Input — reads the redstone signal (
0to15) arriving at that face viaP.get(). CallingP.set(...)on an input faults the scan. - Output — emits a signal (
0to15) staged viaP.set(level). CallingP.get()on a bare output returns its currently held output level.
LEVER = point("lever/redstone")LAMP = point("lamp/redstone")
def scan(): LAMP.set(LEVER.get())Safe fault values
Section titled “Safe fault values”Every Redstone Output has a Fault value setting (0–15, default 0). Whenever the PLC enters Stopped, Waiting, or Fault—or gets broken or unbound—the output immediately switches to its Fault value.
- Leave Fault value at
0for generators, quarries, or doors that should turn off if something goes wrong. - Set Fault value to
15for machines that take an inverted redstone signal (“high to disable”) so they still fail safe.
Built-in timers (mplc:timers)
Section titled “Built-in timers (mplc:timers)”Because MPLC scripts never sleep or block, the mod ships a standard timer library called mplc:timers with three functions measured in game ticks (20 ticks = 1 second):
on_delay(reg, input, ticks)— turnsTrueonly afterinputstaysTruecontinuously forticks. Useful for waiting until a tank has been low for 5 seconds before sounding an alarm.off_delay(reg, input, ticks)— turnsTrueimmediately wheninputisTrue, then staysTrueforticksafterinputgoesFalse. Useful for keeping a generator or pump running a few seconds extra so it never flickers on and off.pulse(reg, trigger, ticks)— outputsTruefortickswhenevertriggerrises fromFalsetoTrue(a rising edge).
Give each independent timer its own local register initialized to [-1, False]:
load("mplc:timers", "on_delay")
LEVER = point("lever/redstone")LAMP = point("lamp/redstone")HELD = register("held", [-1, False])
def scan(): ready = on_delay(HELD, LEVER.get() > 0, 40) # 40 ticks = 2 seconds LAMP.set(15 if ready else 0)Note that stopping the PLC preserves register values, so an on_delay timer keeps its saved start tick until it observes False on a running scan.
Not an official Minecraft website. Not approved by or associated with Mojang or Microsoft.