Class RedstoneInteractions

java.lang.Object
codechicken.multipart.api.RedstoneInteractions

public class RedstoneInteractions extends Object
static helper class for calculating various things about redstone. Indirect power (also known as strong power) is not handled here, just use world.getIndirectPowerTo Masks are defined in IRedstoneConnector
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    connectionMask(MultiPart p, int side)
    Get the connection mask of part on side
    static int
    getConnectionMask(net.minecraft.world.level.LevelReader world, net.minecraft.core.BlockPos pos, int side, boolean power)
     
    static int
    getPower(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, int side, int mask)
    Get the direct power level provided by space (pos) on side with mask
    static int
    getPowerTo(MultiPart p, int side)
    Get the direct power to p on side
    static int
    getPowerTo(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, int side, int mask)
    Get the direct power level to space (pos) on side with mask
    static int
    otherConnectionMask(net.minecraft.world.level.LevelReader world, net.minecraft.core.BlockPos pos, int side, boolean power)
    Get the connection mask of the block on side of (pos).
    static int
    vanillaConnectionMask(net.minecraft.world.level.LevelReader world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, int side, boolean power)
    Returns the connection mask for a vanilla block

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RedstoneInteractions

      public RedstoneInteractions()
  • Method Details

    • getPowerTo

      public static int getPowerTo(MultiPart p, int side)
      Get the direct power to p on side
    • getPowerTo

      public static int getPowerTo(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, int side, int mask)
      Get the direct power level to space (pos) on side with mask
    • getPower

      public static int getPower(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, int side, int mask)
      Get the direct power level provided by space (pos) on side with mask
    • otherConnectionMask

      public static int otherConnectionMask(net.minecraft.world.level.LevelReader world, net.minecraft.core.BlockPos pos, int side, boolean power)
      Get the connection mask of the block on side of (pos).
      Parameters:
      power - , whether the connection mask is for signal transfer or visual connection. (some blocks accept power without visual connection)
    • connectionMask

      public static int connectionMask(MultiPart p, int side)
      Get the connection mask of part on side
    • getConnectionMask

      public static int getConnectionMask(net.minecraft.world.level.LevelReader world, net.minecraft.core.BlockPos pos, int side, boolean power)
      Parameters:
      power - If true, don't test canConnectRedstone on blocks, just get a power transmission mask rather than a visual connection
    • vanillaConnectionMask

      public static int vanillaConnectionMask(net.minecraft.world.level.LevelReader world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, int side, boolean power)
      Returns the connection mask for a vanilla block