diff --git a/leaf-server/src/main/java/org/dreeam/leaf/world/block/OptimizedPoweredRails.java b/leaf-server/src/main/java/org/dreeam/leaf/world/block/OptimizedPoweredRails.java index f4f3c7be..7e34b2e1 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/world/block/OptimizedPoweredRails.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/world/block/OptimizedPoweredRails.java @@ -20,8 +20,6 @@ public class OptimizedPoweredRails { private static final int UPDATE_FORCE_PLACE = UPDATE_MOVE_BY_PISTON | UPDATE_KNOWN_SHAPE | UPDATE_CLIENTS; - private static int RAIL_POWER_LIMIT = 8; - private static final Object2BooleanOpenHashMap CHECKED_POS_POOL = new Object2BooleanOpenHashMap<>(); private static void giveShapeUpdate(Level level, BlockState state, BlockPos pos, BlockPos fromPos, Direction direction) { @@ -36,14 +34,6 @@ public class OptimizedPoweredRails { ); } - public static int getRailPowerLimit() { - return RAIL_POWER_LIMIT; - } - - public static void setRailPowerLimit(int powerLimit) { - RAIL_POWER_LIMIT = powerLimit; - } - public static void updateState(PoweredRailBlock self, BlockState state, Level level, BlockPos pos) { boolean shouldBePowered = level.hasNeighborSignal(pos) || findPoweredRailSignalFaster(self, level, pos, state, true, 0, CHECKED_POS_POOL) || @@ -97,7 +87,7 @@ public class OptimizedPoweredRails { private static boolean findPoweredRailSignalFaster(PoweredRailBlock self, Level level, BlockPos pos, BlockState state, boolean searchForward, int distance, Object2BooleanOpenHashMap checkedPos) { - if (distance >= RAIL_POWER_LIMIT - 1) return false; + if (distance >= level.purpurConfig.railActivationRange) return false; int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); @@ -203,7 +193,8 @@ public class OptimizedPoweredRails { private static void setRailPositionsPower(PoweredRailBlock self, Level level, BlockPos pos, Object2BooleanOpenHashMap checkedPos, int[] count, int i, Direction dir) { - for (int z = 1; z < RAIL_POWER_LIMIT; z++) { + final int railPowerLimit = level.purpurConfig.railActivationRange; + for (int z = 1; z < railPowerLimit; z++) { BlockPos newPos = pos.relative(dir, z); BlockState state = level.getBlockState(newPos); if (checkedPos.containsKey(newPos)) { @@ -229,7 +220,8 @@ public class OptimizedPoweredRails { int[] count, int i, Direction dir) { Object2BooleanOpenHashMap checkedPos = CHECKED_POS_POOL; checkedPos.clear(); - for (int z = 1; z < RAIL_POWER_LIMIT; z++) { + final int railPowerLimit = level.purpurConfig.railActivationRange; + for (int z = 1; z < railPowerLimit; z++) { BlockPos newPos = pos.relative(dir, z); BlockState state = level.getBlockState(newPos); if (!state.is(self) || !state.getValue(POWERED) || level.hasNeighborSignal(newPos) ||