Skip to content

Interfaces

Meredith Espinosa edited this page Jan 16, 2019 · 2 revisions

Currently, InfraRedstone has eight interfaces designed to help create addons and extended features.

InfraRedstoneCapable

This interface is designed to replace Capabilities in Forge mods. It should only be implemented onto BlockEntities, since it needs to get its world and position from the BE. Both methods are passed the direction they're being inspected from, and return equivalents for Forge's hasCapability and getCapability.

InfraRedstoneSignal and SimpleInfraRedstoneSignal

These interfaces are designed for the use with an InfraRedstone handler, connected to through InfraRedstoneCapable. Each returns a value from 0-63 for other modules to read. SimpleInfraRedstoneSignal is designed to be used without a BlockEntity, so it must be passed information like its World, BlockPos, and BlockState, and the Direction it's being accessed from. SimpleInfraRedstoneSignal also includes a Boolean to inform other blocks of whether they can connect to it, since InfraRedstoneCapable is designed to only be implemented onto BlockEntities.

EncoderScannable and SimpleEncoderScannable

These interfaces are designed to interact with the Encoder currently in development builds of InfraRedstone. They can also be used for other logic systems, like computers or device activation. Each returns a value from 0-63 for a comparator-style module to read. SimpleEncoderScannable is designed to be used without a BlockEntity, so it must be passed information like its World, BlockPos, and BlockState, and the Direction it's being accessed from.

MultimeterProbeProvider

This interface is used to serve information to a Multimeter for the use of debugging InfraRedstone projects. It returns a StringTextComponent that will be sent to a player as a Message in the notification area. The probe message should contain the signal output of the device, as well as any other necessary information that may be necessary. When giving information to the player, always format a signal value in the format of 0b11_1111 (63).

InfraRedstoneWire

This interface designates any blocks that should be used with InRedLogic.wireSearch() to grab an InfraRedstone signal from a wire. Used in the built-in InfraRedstoneCable and InfraRedstoneScaffold.

AxisRestricted

This interface designates any blocks that should only be connected to on a standard axis, with diagonal connections disallowed. Used in the built-in InfraRedstoneScaffold and InfraRedstoneBlock. Ignored in the special case of a non-AxisRestricted wire reaching up to an AxisRestricted block, like on the left here.