Class AbstractNetworkedRedstoneModule

java.lang.Object
me.desht.pneumaticcraft.common.tubemodules.AbstractTubeModule
me.desht.pneumaticcraft.common.tubemodules.AbstractNetworkedRedstoneModule
Direct Known Subclasses:
RedstoneModule, ThermostatModule

public abstract class AbstractNetworkedRedstoneModule extends AbstractTubeModule
  • Method Details

    • tickServer

      public void tickServer()
      Overrides:
      tickServer in class AbstractTubeModule
    • getInputChannel

      protected int getInputChannel()
      Returns:
      the input channel of this module, or -1 if not inputting
    • getInputLevel

      public int getInputLevel()
    • setInputLevel

      public void setInputLevel(int inputLevel)
      Should only be used on client side Called on client when a sync packet is received, and on server when saved data is loaded
    • calculateInputLevel

      protected int calculateInputLevel()
      Returns:
      the current input signal level
    • updateInputLevel

      public final boolean updateInputLevel()
      Checks and updates the input level.
      Returns:
      did the input level change
    • onInputLevelChange

      protected void onInputLevelChange(int level)
      Called when this module's input level is changed.
      Parameters:
      level - the new input level
    • fetchNetworkInputLevels

      protected final byte[] fetchNetworkInputLevels()
    • notifyInputLevelsChanged

      protected final void notifyInputLevelsChanged(int channel)
      Notify all modules in the network about an input level change of channel. Call this whenever an "inputting" module's input changes.
      Parameters:
      channel - the changed channel, or -1 to update all channels
    • isWatchingChannel

      protected boolean isWatchingChannel(int channel)
      Returns:
      if this module is "watching" channel (if updateOutput(byte[]) should be called when the respective channels updates)
    • updateOutput

      protected void updateOutput(@Nullable byte[] levels)
      This gets called by notifyInputLevelsChanged(int) when the input levels of the channels that this module is watching changes.
      Parameters:
      levels - the input levels of all channels
    • onNetworkReform

      public static void onNetworkReform(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos)
      Called when the network is reformed (e.g. tube place and destroy)
    • canConnectTo

      public final boolean canConnectTo(AbstractTubeModule other)
      Overrides:
      canConnectTo in class AbstractTubeModule
    • onPlaced

      public void onPlaced()
      Overrides:
      onPlaced in class AbstractTubeModule