@@ -20,8 +20,6 @@ public class OptimizedPoweredRails {
2020
2121 private static final int UPDATE_FORCE_PLACE = UPDATE_MOVE_BY_PISTON | UPDATE_KNOWN_SHAPE | UPDATE_CLIENTS ;
2222
23- private static int RAIL_POWER_LIMIT = 8 ;
24-
2523 private static final Object2BooleanOpenHashMap <BlockPos > CHECKED_POS_POOL = new Object2BooleanOpenHashMap <>();
2624
2725 private static void giveShapeUpdate (Level level , BlockState state , BlockPos pos , BlockPos fromPos , Direction direction ) {
@@ -36,14 +34,6 @@ private static void giveShapeUpdate(Level level, BlockState state, BlockPos pos,
3634 );
3735 }
3836
39- public static int getRailPowerLimit () {
40- return RAIL_POWER_LIMIT ;
41- }
42-
43- public static void setRailPowerLimit (int powerLimit ) {
44- RAIL_POWER_LIMIT = powerLimit ;
45- }
46-
4737 public static void updateState (PoweredRailBlock self , BlockState state , Level level , BlockPos pos ) {
4838 boolean shouldBePowered = level .hasNeighborSignal (pos ) ||
4939 findPoweredRailSignalFaster (self , level , pos , state , true , 0 , CHECKED_POS_POOL ) ||
@@ -97,7 +87,7 @@ private static boolean findPoweredRailSignalFaster(PoweredRailBlock self, Level
9787 private static boolean findPoweredRailSignalFaster (PoweredRailBlock self , Level level ,
9888 BlockPos pos , BlockState state , boolean searchForward , int distance ,
9989 Object2BooleanOpenHashMap <BlockPos > checkedPos ) {
100- if (distance >= RAIL_POWER_LIMIT - 1 ) return false ;
90+ if (distance >= level . purpurConfig . railActivationRange ) return false ;
10191 int x = pos .getX ();
10292 int y = pos .getY ();
10393 int z = pos .getZ ();
@@ -203,7 +193,8 @@ private static void dePowerLane(PoweredRailBlock self, Level level, BlockPos pos
203193
204194 private static void setRailPositionsPower (PoweredRailBlock self , Level level , BlockPos pos ,
205195 Object2BooleanOpenHashMap <BlockPos > checkedPos , int [] count , int i , Direction dir ) {
206- for (int z = 1 ; z < RAIL_POWER_LIMIT ; z ++) {
196+ final int railPowerLimit = level .purpurConfig .railActivationRange ;
197+ for (int z = 1 ; z < railPowerLimit ; z ++) {
207198 BlockPos newPos = pos .relative (dir , z );
208199 BlockState state = level .getBlockState (newPos );
209200 if (checkedPos .containsKey (newPos )) {
@@ -229,7 +220,8 @@ private static void setRailPositionsDePower(PoweredRailBlock self, Level level,
229220 int [] count , int i , Direction dir ) {
230221 Object2BooleanOpenHashMap <BlockPos > checkedPos = CHECKED_POS_POOL ;
231222 checkedPos .clear ();
232- for (int z = 1 ; z < RAIL_POWER_LIMIT ; z ++) {
223+ final int railPowerLimit = level .purpurConfig .railActivationRange ;
224+ for (int z = 1 ; z < railPowerLimit ; z ++) {
233225 BlockPos newPos = pos .relative (dir , z );
234226 BlockState state = level .getBlockState (newPos );
235227 if (!state .is (self ) || !state .getValue (POWERED ) || level .hasNeighborSignal (newPos ) ||
0 commit comments