Heads up!
As of 1.22, More Red uses the Ex Machina framework to get all the wires and cables to connect to each other nicely.
Mods can add compatibility with the wire system by depending on Ex Machina. See the Ex Machina github for dependency information.
The Signal Graph
Ex Machina's Signal Graph system handles
- Listening to graph update requests
- The connecting of wire blocks and assembling them into graph networks
- Determining the highest input signal provided to a given signal graph
- Updating all wire blocks in the graph simultaneously (avoiding cascading block updates)
- Updating non-graph neighbor blocks adjacent to the graph
Blocks can be made graphable by assigning data map components to blocks; there are three datamaps used to define this behavior:
data/exmachina/data_maps/block/signal_source.json
specifies Signal Sources which only provide power to adjacent graphsdata/exmachina/data_maps/block/signal_transmitter.json
specifies Signal Transmitters which provide unique graph nodes, can read vanilla redstone signals from neighbors, and listen to signal changesdata/exmachina/data_maps/block/signal_receiver.json
specifies Signal Receivers which can only listen to signal updates of adjacent graphs
A block with no datamap components acts as a default signal source, which connects to wires and provides its vanilla signal to the graph if it meets these conditions:
- It provides vanilla redstone signal
- It can connect to redstone dust (
IBlockExtension#canConnectRedstone
returns true) - Its block support shape reaches the side of the block adjacent to a connecting wire and is at least as large as a Red Alloy Wire cross-section (2x2 sixteenths at the center of the edge of the block)
Ex Machina also assigns additional signal source components to vanilla blocks which ought to connect to wires but do not meet this criteria:
Mods with similar blocks can add compatibility without compiling against Ex Machina by adding them to these tags, or by adding them to a datamap using exmachina's builtin source types (cube, floor, wall_floor_ceiling).
Mods which wish to add specialized compatibility (such as for interfacing with bundled cables) should depend on Ex Machina
and register source/transmitter/receiver codecs for their block (registry keys for deferredregisters are available in ExMachinaRegistries
)
which can be referred to in the data maps.
Graph updates can be requested by invoking SignalGraphUpdateGameEvent#scheduleSignalGraphUpdate(BlockPos)
, which causes a graph update to occur at that position
at the end of the current level tick.
Blocks which act as both signal graph transmitters and provide vanilla redstone signal should be added to the exmachina:ignore_vanilla_signal
block tag