API Reference
Complete documentation of every public class, interface, record, and enum
in the com.hypernova.spc.api package tree.
SpcNodeSchema, SpcPortSpec, ISpcCompiledNode,
ISpcExecutionContext, SpcSignalValue, SpcNodeRegistry.
Jump to class
- SpcApi
- SpcNodeSchema
- SpcPortSpec
- SpcPortDirection
- SpcParameterSpec
- SpcParameterValueType
- ISpcCompiledNode
- ISpcNodeFactory
- NodeCompilationContext
- ISpcExecutionContext
- ISpcExecutionContextExtension
- SpcExecutionPhase
- SpcSignalType
- SpcSignalValue
- SpcSignalAddress
- ISpcRuntimeState
- SpcNodeCategory
- SpcNodeRegistry
- SpcNodeRegistration
- SpcNodeColors
- SpcProgramBlockStyle
- SpcProgramBlockCategory
- SpcProgramBlockRegistry
- SpcContextExtensionRegistry
- ISpcMultiblockModule
- SpcModuleType
- SpcMultiblockPosition
- ISpcPhysicalIoHandler
- SpcModuleTypeRegistry
- ISpcNetworkDevice
- ISpcNetworkActivation
- ISpcCableTraversable
- SpcNetworkRegistry
- ISpcRuntimeEventListener
- SpcRuntimeEventRegistry
SpcApi
api public final class SpcApi
Version constants and mod identifiers.
| Field | Type | Value | Description |
|---|---|---|---|
API_VERSION | int | 3 | Incremented on any breaking API change |
MOD_ID | String | "storedprogramcontrols" | Main SPC mod identifier |
CORE_MOD_ID | String | "spc_core" | API mod identifier β depend on this in your mods.toml |
SpcNodeSchema
api.node public record SpcNodeSchema
Declares a function block node type. Immutable after construction.
Constructors
new SpcNodeSchema(String typeId, SpcExecutionPhase phase, List<SpcPortSpec> ports, List<SpcParameterSpec> parameters, boolean requiresDisplay)
new SpcNodeSchema(String typeId, SpcExecutionPhase phase, List<SpcPortSpec> ports, List<SpcParameterSpec> parameters, boolean requiresDisplay, String displayName, String shortLabel, String description) // v1.1.0+
Record components
| Component | Type | Description |
|---|---|---|
typeId | String | Globally unique node type ID (e.g., "mymod:sensor") |
phase | SpcExecutionPhase | Execution phase |
ports | List<SpcPortSpec> | Port declarations (immutable copy) |
parameters | List<SpcParameterSpec> | Parameter declarations (immutable copy) |
requiresDisplay | boolean | Whether this node needs a display block |
displayName | String | Nullable β human-readable name for the palette (e.g., "Rotation Input"). Falls back to category + typeId. |
shortLabel | String | Nullable β 1-3 character icon text on the block in the diagram (e.g., "RI"). Falls back to first 3 chars of typeId. |
description | String | Nullable β tooltip description text (e.g., "Reads rotation data"). Falls back to "N inputs, M outputs". |
Methods
| Method | Returns | Description |
|---|---|---|
findPort(String portId) | Optional<SpcPortSpec> | Find a port by its ID |
findParameter(String parameterId) | Optional<SpcParameterSpec> | Find a parameter by its ID |
portsById() | Map<String, SpcPortSpec> | All ports indexed by port ID |
parametersById() | Map<String, SpcParameterSpec> | All parameters indexed by ID |
SpcPortSpec
api.node public record SpcPortSpec
Declares a single input or output port on a node type.
Constructors
new SpcPortSpec(String portId, SpcPortDirection direction, SpcSignalType signalType, boolean required, String signalDomain)
new SpcPortSpec(String portId, SpcPortDirection direction, SpcSignalType signalType, boolean required) // signalDomain defaults to null (universal)
| Component | Type | Description |
|---|---|---|
portId | String | Unique within the node (e.g., "I1", "Q") |
direction | SpcPortDirection | INPUT or OUTPUT |
signalType | SpcSignalType | Data type: DIGITAL, INTEGER, etc. |
required | boolean | Whether a connection is required for valid programs |
signalDomain | String | Optional domain tag (e.g., "rotation", "fluid"). null = universal compatibility. |
Methods
| Method | Returns | Description |
|---|---|---|
isDomainCompatible(SpcPortSpec other) | boolean | True if either domain is null or both are equal |
SpcPortDirection
api.node public enum SpcPortDirection
| Value | Serialized | Description |
|---|---|---|
INPUT | "input" | Port receives data from upstream node |
OUTPUT | "output" | Port sends data to downstream nodes |
Methods: getSerializedName(), fromSerializedName(String)
SpcParameterSpec
api.node public record SpcParameterSpec
Declares a user-configurable parameter. Set in the editor, constant during execution.
Constructor
new SpcParameterSpec(String parameterId, SpcParameterValueType valueType, boolean required)
| Component | Type | Description |
|---|---|---|
parameterId | String | Unique within the node (e.g., "radius") |
valueType | SpcParameterValueType | BOOLEAN, INTEGER, DECIMAL, or TEXT |
required | boolean | Must be set before running |
SpcParameterValueType
api.node public enum SpcParameterValueType
| Value | Serialized | Java type |
|---|---|---|
BOOLEAN | "boolean" | boolean |
INTEGER | "integer" | int |
DECIMAL | "decimal" | double |
TEXT | "text" | String |
ISpcCompiledNode
api.node public interface ISpcCompiledNode
A compiled, executable instance of a function block node. Created by a factory, executed every tick.
| Method | Returns | Description |
|---|---|---|
nodeId() | UUID | Unique ID of this node instance |
typeId() | String | Node type identifier (matches schema) |
phase() | SpcExecutionPhase | Which phase this node executes in |
execute(context, state) | void | Run this node for one tick |
ISpcRuntimeState persistent slots.
ISpcNodeFactory
api.node public interface ISpcNodeFactory
Factory that compiles a node definition into an executable instance.
| Method | Returns | Description |
|---|---|---|
create(NodeCompilationContext context) | ISpcCompiledNode | Create a compiled node from the compilation context |
Can be implemented as a lambda:
ISpcNodeFactory factory = ctx -> new MyNode(ctx.nodeId(), ctx.outputAddress("Q"));
NodeCompilationContext
api.node public record ISpcNodeFactory.NodeCompilationContext
Compilation context passed to factories. Contains resolved addresses and parameter values.
Record components
| Component | Type | Description |
|---|---|---|
nodeId | UUID | Unique instance ID |
typeId | String | Schema type ID |
inputAddresses | Map<String, SpcSignalAddress> | Resolved input port β source signal addresses |
outputAddresses | Map<String, SpcSignalAddress> | Resolved output port β signal addresses |
parameterValues | Map<String, String> | Raw parameter values from the editor |
invertedInputs | Map<String, Boolean> | Which inputs have negation bubbles |
Helper methods
| Method | Returns | Description |
|---|---|---|
inputAddress(String portId) | SpcSignalAddress | Address of an input port's source (null if unconnected) |
outputAddress(String portId) | SpcSignalAddress | Address for an output port (always non-null) |
isInverted(String portId) | boolean | Whether input has a negation bubble |
stringParameter(String id, String def) | String | String parameter with default |
intParameter(String id, int def) | int | Integer parameter with default (parse-safe) |
longParameter(String id, long def) | long | Long parameter with default (parse-safe) |
doubleParameter(String id, double def) | double | Double parameter with default (parse-safe) |
booleanParameter(String id, boolean def) | boolean | Boolean parameter with default |
numberedInputAddresses(String prefix, int count) | List<SpcSignalAddress> | Collect prefix1, prefix2, β¦, prefixN addresses |
ISpcExecutionContext
api.execution public interface ISpcExecutionContext
World interaction interface passed to every node's execute(). All methods have safe defaults.
Digital I/O
| Method | Returns | Description |
|---|---|---|
readDigitalInput(int channel) | boolean | Read a digital input channel |
applyDigitalOutputs(Map<Integer, Boolean>) | void | Apply digital output states |
Analog I/O
| Method | Returns | Default |
|---|---|---|
readAnalogInput(int channel) | int | 0 |
applyAnalogOutputs(Map<Integer, Integer>) | void | no-op |
Forge Energy (FE) I/O
| Method | Returns | Default |
|---|---|---|
readFeInput(int channel) | int | 0 |
applyFeOutputs(Map<Integer, Integer>) | void | no-op |
Virtual Signals
| Method | Returns | Default |
|---|---|---|
readVirtualDigital(String key) | boolean | false |
readVirtualInteger(String key) | int | 0 |
readVirtualDecimal(String key) | double | 0.0 |
writeVirtualDigital(String key, boolean v) | void | no-op |
writeVirtualInteger(String key, int v) | void | no-op |
writeVirtualDecimal(String key, double v) | void | no-op |
Time
| Method | Returns | Default |
|---|---|---|
worldTimeTicks() | long | 0 |
isDaytime() | boolean | Computed from worldTimeTicks |
Display
| Method | Description |
|---|---|
publishDisplayMessage(UUID nodeId, String msg, boolean active) | Show message on the machine's display |
publishExternalDisplayMessage(String ip, UUID nodeId, String msg, boolean active) | Send to an external display at the given IP |
World Sensors
| Method | Returns | Description |
|---|---|---|
isRaining() | boolean | Weather status |
isThundering() | boolean | Storm status |
getLightLevel(int x, int y, int z) | int | Light at offset from machine (0β15) |
getPlayerDistance() | int | Distance to nearest player (MAX_VALUE if none) |
countEntitiesInRadius(int radius, String type) | int | Count entities of type within radius |
isBlockAt(int x, int y, int z, String blockId) | boolean | Block check at offset |
getContainerFillLevel(int x, int y, int z) | int | Container comparator level (0β15) |
getBiomeId() | String | Biome at machine position |
getMoonPhase() | int | Moon phase (0β7) |
Effects
| Method | Description |
|---|---|
playNote(int instrument, int pitch) | Play a note block sound |
emitParticles(String type, int count) | Spawn particles |
launchSignalFlare(int color) | Launch a colored signal flare |
sendChatMessage(UUID nodeId, String sender, String msg) | Send a chat message |
Items
| Method | Returns | Description |
|---|---|---|
readItemInputId(int channel, int slot) | String | Item ID at channel/slot |
readItemInputCount(int channel, int slot) | int | Item count at channel/slot |
readInventoryFingerprint(int channel) | long | Hash for change detection |
applyItemOutputs(Map, Map) | void | Set item outputs |
Data Logging
| Method | Description |
|---|---|
recordDataLog(UUID nodeId, Map<String, SpcSignalValue>) | Log named values for the data recorder |
Extensions
| Method | Returns | Description |
|---|---|---|
getExtension(Class<T>) | Optional<T> | Retrieve a registered context extension |
Custom Module I/O
| Method | Returns | Default | Description |
|---|---|---|---|
readCustomInput(String moduleTypeId, int channel) | SpcSignalValue | INTEGER_ZERO | Read from a custom multiblock module's input channel |
applyCustomOutputs(String moduleTypeId, Map<Integer, SpcSignalValue>) | void | no-op | Apply values to a custom module's output channels |
ISpcExecutionContextExtension
api.execution public interface ISpcExecutionContextExtension
Base interface for addon execution context extensions.
| Method | Returns | Description |
|---|---|---|
onTickStart(ServerLevel level, BlockPos machinePos) | void | Called once per machine per tick, before node execution. Default: no-op. |
SpcExecutionPhase
api.execution public enum SpcExecutionPhase
| Value | Order | Purpose |
|---|---|---|
INPUT_READ | 1 | Sample physical and virtual inputs |
LOGIC_EVALUATION | 2 | Combinational logic, math, comparisons |
STATE_UPDATE | 3 | Timers, counters, memory elements |
OUTPUT_APPLY | 4 | Write physical and virtual outputs |
SpcSignalType
api.signal public enum SpcSignalType
| Value | Serialized | Java Type |
|---|---|---|
DIGITAL | "digital" | boolean |
INTEGER | "integer" | int |
DECIMAL | "decimal" | double |
TEXT | "text" | String |
ITEM | "item" | String + int |
ITEM_ID | "item_id" | String |
Methods: getSerializedName(), fromSerializedName(String)
SpcSignalValue
api.signal public record SpcSignalValue
Runtime signal container carrying a typed value between nodes.
Record components
| Component | Type | Description |
|---|---|---|
type | SpcSignalType | Signal type enum |
digitalValue | boolean | Boolean payload |
integerValue | int | Integer payload |
decimalValue | double | Decimal payload |
textValue | String | Text payload (never null) |
Factory methods
| Method | Creates |
|---|---|
digital(boolean v) | DIGITAL signal |
integer(int v) | INTEGER signal (also sets decimalValue) |
decimal(double v) | DECIMAL signal (also sets integerValue) |
text(String v) | TEXT signal |
item(String itemId, int count) | ITEM signal (ID + count) |
itemId(String itemId) | ITEM_ID signal |
Conversion methods
| Method | Returns | Cross-type behavior |
|---|---|---|
asDigital() | boolean | Non-zero/non-empty β true |
asInteger() | int | Rounds decimals, parses text, boolβ0/1 |
asDecimal() | double | Parses text, boolβ0.0/1.0 |
asText() | String | Numbersβstring, boolβ"0"/"1", itemβ"id x count" |
asItemId() | String | Extracts textValue from ITEM/ITEM_ID/TEXT |
asItemCount() | int | integerValue from ITEM/INTEGER; boolβ0/1 |
Static constants
DIGITAL_FALSE, DIGITAL_TRUE, INTEGER_ZERO,
DECIMAL_ZERO, TEXT_EMPTY, ITEM_EMPTY, ITEM_ID_EMPTY
SpcSignalAddress
api.signal public record SpcSignalAddress
Identifies a specific port on a specific node instance. Used as keys in the signal bus.
| Component | Type | Description |
|---|---|---|
nodeId | UUID | Node instance ID |
portId | String | Port identifier within the node |
ISpcRuntimeState
api.state public interface ISpcRuntimeState
Mutable runtime state: signal bus + persistent storage + physical output channels.
Signal Bus
| Method | Returns | Description |
|---|---|---|
setSignal(SpcSignalAddress, SpcSignalValue) | void | Write a signal to the bus |
readDigitalSignal(SpcSignalAddress) | boolean | Read as boolean (false default) |
readIntegerSignal(SpcSignalAddress) | int | Read as int (0 default) |
readDecimalSignal(SpcSignalAddress) | double | Read as double (0.0 default) |
readTextSignal(SpcSignalAddress) | String | Read as text ("" default) |
readSignalValue(SpcSignalAddress) | SpcSignalValue | Read raw value (ITEM_EMPTY default) |
Physical Output Channels
| Method | Description |
|---|---|
setDigitalOutput(int channel, boolean active) | Set digital output channel |
setAnalogOutput(int channel, int value) | Set analog output channel (0β15) |
setFeOutput(int channel, int amount) | Set FE output channel |
Persistent Slots
| Type | Get | Set (pending) |
|---|---|---|
| Boolean | getBooleanSlot(UUID, String) | setPendingBooleanSlot(UUID, String, boolean) |
| Integer | getIntegerSlot(UUID, String) | setPendingIntegerSlot(UUID, String, int) |
| Long | getLongSlot(UUID, String) | setPendingLongSlot(UUID, String, long) |
| Double | getDoubleSlot(UUID, String) | setPendingDoubleSlot(UUID, String, double) |
| Text | getTextSlot(UUID, String) | setPendingTextSlot(UUID, String, String) |
Markers (named global variables)
| Type | Get | Set (pending) |
|---|---|---|
| Boolean | getMarkerValue(String) | setPendingMarkerValue(String, boolean) |
| Integer | getAnalogMarkerValue(String) | setPendingAnalogMarkerValue(String, int) |
| String | getStringMarkerValue(String) | setPendingStringMarkerValue(String, String) |
Latch / Flip-Flop State
| Method | Returns |
|---|---|
getLatchState(UUID nodeId) | boolean |
setPendingLatchState(UUID nodeId, boolean) | void |
Delay Counters
| Method | Returns |
|---|---|
getOnDelayCounter(UUID nodeId) | int |
setPendingOnDelayCounter(UUID nodeId, int) | void |
SpcNodeCategory
api.category public record SpcNodeCategory
Groups nodes in the editor palette sidebar.
Constructors
new SpcNodeCategory(String categoryId, String displayName, int sortOrder, String iconTexture)
new SpcNodeCategory(String categoryId, String displayName, int sortOrder) // iconTexture defaults to null
new SpcNodeCategory(String categoryId, String displayName) // sortOrder defaults to 5000, iconTexture to null
| Component | Type | Description |
|---|---|---|
categoryId | String | Unique ID (e.g., "mymod:sensors"). Namespace it! |
displayName | String | Shown in the palette sidebar header |
sortOrder | int | Lower = higher in list. Built-in: 0β1000. Use 5000+ for addons. |
iconTexture | String | Optional resource location for a category icon (e.g., "mymod:textures/gui/sensors.png"). null = no icon. |
Methods
| Method | Returns | Description |
|---|---|---|
hasIcon() | boolean | Returns true if iconTexture is non-null and non-empty |
SpcNodeRegistry
api.registry public final class SpcNodeRegistry
Central registry for addon node types. Thread-safe. Freezes after mod setup.
| Method | Returns | Description |
|---|---|---|
register(SpcNodeSchema, ISpcNodeFactory, SpcNodeCategory) | void | Register a node type with default brass colors. |
register(SpcNodeSchema, ISpcNodeFactory, SpcNodeCategory, SpcNodeColors) | void | Register a node type with custom editor colors. |
find(String typeId) | Optional<SpcNodeRegistration> | Look up a registered node by type ID. |
all() | Map<String, SpcNodeRegistration> | Unmodifiable view of all registrations. |
isFrozen() | boolean | True if registry is frozen. |
freeze() | void | Internal β called by SPC, not by addons. |
SpcNodeRegistration
api.registry public record SpcNodeRegistration
Bundled registration: schema + factory + category + optional colors.
| Component | Type |
|---|---|
schema | SpcNodeSchema |
factory | ISpcNodeFactory |
category | SpcNodeCategory |
colors | SpcNodeColors (nullable) |
| Method | Returns | Description |
|---|---|---|
effectiveColors() | SpcNodeColors | Returns custom colors or SpcNodeColors.DEFAULT. |
SpcNodeColors
api.style public record SpcNodeColors
Custom ARGB colors for rendering a function block node in the programming editor.
| Field | Type | Default | Description |
|---|---|---|---|
fill | int | 0xFFF1D789 | Body background fill |
stroke | int | 0xFF3A2C12 | Border outline |
text | int | 0xFF2A2010 | Symbol text inside the body |
labelText | int | 0xFFF3E8C4 | Label text above the node |
activeFill | int | 0xFFF7E7A7 | Fill when active in simulation |
| Static | Returns | Description |
|---|---|---|
DEFAULT | SpcNodeColors | The built-in brass palette. |
of(int fill, int stroke) | SpcNodeColors | Auto-derives text and active colors from fill/stroke. |
fromAccent(int accent) | SpcNodeColors | Derives all 5 colors from a single accent color. |
SpcProgramBlockStyle
api.style public record SpcProgramBlockStyle
Defines the tint colors for a programming block variant in the world.
| Field | Type | Default | Description |
|---|---|---|---|
primaryTint | int | 0xFFD4A84B | Primary body tint for the block model |
secondaryTint | int | 0xFF8B7234 | Secondary accent tint for trim/details |
emissiveTint | int | 0xFF66BB6A | LED/indicator light color |
| Static | Returns | Description |
|---|---|---|
DEFAULT | SpcProgramBlockStyle | The built-in brass style. |
fromAccent(int accent) | SpcProgramBlockStyle | Derives primary + secondary from one color (keeps green LED). |
SpcProgramBlockCategory
api.style public record SpcProgramBlockCategory
A programming block category that addons register to provide new themed block variants.
| Field | Type | Description |
|---|---|---|
categoryId | String | Unique ID in namespaced format: "mymod:advanced_programmer" |
displayName | String | Human-readable name for tooltips and creative menu |
style | SpcProgramBlockStyle | Nullable β uses brass default if null |
| Method | Returns | Description |
|---|---|---|
effectiveStyle() | SpcProgramBlockStyle | Returns custom style or SpcProgramBlockStyle.DEFAULT. |
SpcProgramBlockRegistry
api.registry public final class SpcProgramBlockRegistry
Registry for addon programming block categories. Thread-safe. Freezes after mod setup.
| Method | Returns | Description |
|---|---|---|
register(SpcProgramBlockCategory) | void | Register a programming block category. Throws if frozen or duplicate. |
find(String categoryId) | Optional<SpcProgramBlockCategory> | Look up a category by ID. |
all() | Map<String, SpcProgramBlockCategory> | Unmodifiable view of all categories. |
isFrozen() | boolean | True if registry is frozen. |
freeze() | void | Internal β called by SPC, not by addons. |
SpcContextExtensionRegistry
api.registry public final class SpcContextExtensionRegistry
Central registry for context extensions. Thread-safe. Freezes after mod setup.
| Method | Returns | Description |
|---|---|---|
register(Class<T>, T instance) | void | Register an extension. Throws if frozen or duplicate. |
get(Class<T>) | Optional<T> | Retrieve extension by interface class. |
all() | Map<Class<?>, ...> | Unmodifiable view of all extensions. |
notifyTickStart(ServerLevel, BlockPos) | void | Internal β called by SPC runtime each tick. |
isFrozen() | boolean | True if registry is frozen. |
freeze() | void | Internal β called by SPC, not by addons. |
Multiblock Module API
The api.multiblock package allows addons to register custom physical blocks
that participate in LOGO multiblock discovery and validation.
ISpcMultiblockModule
api.multiblock @FunctionalInterface public interface ISpcMultiblockModule
Blocks implement this interface to be discovered by the LOGO multiblock BFS scanner.
The module type ID must match a type registered in SpcModuleTypeRegistry.
| Method | Returns | Description |
|---|---|---|
getModuleTypeId() | String | Registered module type ID (e.g., "mymod:rotational_input") |
SpcModuleType
api.multiblock public record SpcModuleType
Describes a custom multiblock module type β where it can be placed and whether it handles I/O.
Constructors
new SpcModuleType(String moduleTypeId, String displayName, SpcMultiblockPosition position, boolean isIoModule)
new SpcModuleType(String moduleTypeId, String displayName, SpcMultiblockPosition position) // isIoModule defaults to true
| Component | Type | Description |
|---|---|---|
moduleTypeId | String | Globally unique ID (e.g., "mymod:rotational_input") |
displayName | String | Human-readable name shown in GUI |
position | SpcMultiblockPosition | Which multiblock row this type occupies |
isIoModule | boolean | Whether this module participates in channel assignment |
SpcMultiblockPosition
api.multiblock public enum SpcMultiblockPosition
Valid placement rows within the 2×3 LOGO multiblock grid.
| Value | Description |
|---|---|
INPUT_ROW | Top row (y=+1, column ≥ 1) β input modules |
OUTPUT_ROW | Bottom row (y=−1) β output modules |
MIDDLE_ROW | Middle row (y=0, column ≥ 1) β processing/display modules |
POWER_ROW | Power slot (y=+1, column 0) β energy modules |
ISpcPhysicalIoHandler
api.multiblock public interface ISpcPhysicalIoHandler
Handles reading/writing signal values for custom I/O module blocks at runtime.
| Method | Returns | Default | Description |
|---|---|---|---|
readInput(ServerLevel, BlockPos) | SpcSignalValue | INTEGER_ZERO | Read the current value from this I/O block |
applyOutput(ServerLevel, BlockPos, SpcSignalValue) | void | no-op | Apply a computed value to this I/O block |
SpcModuleTypeRegistry
api.multiblock public final class SpcModuleTypeRegistry
Central registry for custom multiblock module types. Thread-safe. Freezes after mod setup.
| Method | Returns | Description |
|---|---|---|
register(SpcModuleType, ISpcPhysicalIoHandler) | void | Register an I/O module type with its handler |
register(SpcModuleType) | void | Register a non-I/O module type (no handler) |
find(String moduleTypeId) | Optional<SpcModuleTypeRegistration> | Look up a module type |
all() | Map<String, SpcModuleTypeRegistration> | All registrations (unmodifiable) |
freeze() | void | Internal β called by SPC |
Inner record: SpcModuleTypeRegistration
| Component | Type |
|---|---|
moduleType | SpcModuleType |
ioHandler | ISpcPhysicalIoHandler (nullable for non-I/O modules) |
Network Device API
The api.network package enables addons to create custom network devices,
wireless activation blocks, and cable-traversable blocks.
ISpcNetworkDevice
api.network public interface ISpcNetworkDevice
Block entities implement this to participate in LOGO network routing as addressable devices.
| Method | Returns | Default | Description |
|---|---|---|---|
getDeviceTypeId() | String | — | Registered device type ID |
getNetworkIp() | String | — | Unique network address (e.g., "192.168.0.10") |
readDeviceValue() | SpcSignalValue | INTEGER_ZERO | Current device signal value |
applyDeviceValue(SpcSignalValue) | void | no-op | Apply a signal value to this device |
ISpcNetworkActivation
api.network public interface ISpcNetworkActivation
Blocks implement this to act as wireless activation sources (buttons, levers, pressure plates).
| Method | Returns | Description |
|---|---|---|
getNetworkName() | String | Transmitter network name this activation block is bound to |
isSignalActive() | boolean | Whether the activation signal is currently active |
ISpcCableTraversable
api.network public interface ISpcCableTraversable
Marker interface (no methods). Blocks implementing this are treated as cable-traversable by the network BFS route finder β allowing addon cable/conduit blocks to participate in network routing.
SpcNetworkRegistry
api.network public final class SpcNetworkRegistry
Registry for custom network device types. Thread-safe. Freezes after mod setup.
| Method | Returns | Description |
|---|---|---|
registerDeviceType(String id, String displayName) | void | Register a new device type |
findDeviceType(String id) | Optional<SpcNetworkDeviceType> | Look up a device type |
allDeviceTypes() | Map<String, SpcNetworkDeviceType> | All device types (unmodifiable) |
freeze() | void | Internal β called by SPC |
Inner record: SpcNetworkDeviceType
| Component | Type |
|---|---|
deviceTypeId | String |
displayName | String |
Runtime Event API
The api.event package provides lifecycle hooks so addons can react
to program start/stop and multiblock assembly/disassembly events.
ISpcRuntimeEventListener
api.event public interface ISpcRuntimeEventListener
Lifecycle hook interface. All methods have empty defaults β override only what you need.
| Method | Parameters | Description |
|---|---|---|
onProgramStart | ServerLevel, BlockPos machinePos | Called when a LOGO program begins execution |
onProgramStop | ServerLevel, BlockPos machinePos | Called when a running program is stopped |
onMultiblockAssemble | ServerLevel, BlockPos machinePos | Called when a multiblock is successfully assembled |
onMultiblockDisassemble | ServerLevel, BlockPos machinePos | Called when a multiblock is broken or invalidated |
SpcRuntimeEventRegistry
api.event public final class SpcRuntimeEventRegistry
Registry for runtime event listeners. Thread-safe. Freezes after mod setup.
| Method | Returns | Description |
|---|---|---|
register(ISpcRuntimeEventListener) | void | Register a listener. Throws if frozen. |
all() | List<ISpcRuntimeEventListener> | Snapshot of all listeners (unmodifiable) |
freeze() | void | Internal β called by SPC |
SpcRuntimeEventRegistry.register(new ISpcRuntimeEventListener() {
@Override
public void onProgramStart(ServerLevel level, BlockPos pos) {
// Initialize addon state for this machine
}
});