From df6a7b1bba3e78ea8ac5f505358047893885634e Mon Sep 17 00:00:00 2001 From: FX - PR0CESS Date: Sun, 20 Mar 2022 00:50:08 -0400 Subject: [PATCH] New Rule: `reIntroduceReverseRailUpdateOrder` Requires Rule `optimizedPoweredRails` to be enabled --- src/main/java/carpetfixes/CFSettings.java | 7 +++ .../PoweredRailBlock_fasterMixin.java | 50 +++++++++++-------- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/src/main/java/carpetfixes/CFSettings.java b/src/main/java/carpetfixes/CFSettings.java index 41f9d25d..e1d6836f 100644 --- a/src/main/java/carpetfixes/CFSettings.java +++ b/src/main/java/carpetfixes/CFSettings.java @@ -1238,6 +1238,13 @@ other bugs, except they deserve a category of their own (for sorting purposes... ) public static boolean reIntroduceInstantBlockUpdates = false; + //By FX - PR0CESS + @Rule( + desc = "Re-introduces reverse rail update order which changed in 22w11a. Requires optimizedPoweredRails", + category = REINTRODUCE + ) + public static boolean reIntroduceReverseRailUpdateOrder = false; + /* diff --git a/src/main/java/carpetfixes/mixins/optimizations/PoweredRailBlock_fasterMixin.java b/src/main/java/carpetfixes/mixins/optimizations/PoweredRailBlock_fasterMixin.java index 3a8ad67e..e1985769 100644 --- a/src/main/java/carpetfixes/mixins/optimizations/PoweredRailBlock_fasterMixin.java +++ b/src/main/java/carpetfixes/mixins/optimizations/PoweredRailBlock_fasterMixin.java @@ -356,18 +356,21 @@ private void updateRails(boolean eastWest, World world, BlockPos pos, BlockState if (i == 1 && countAmt == 0) continue; Direction dir = EAST_WEST_DIR[i]; Block block = mainState.getBlock(); - for (int c = i; c <= countAmt; c++) { - updateRailsSectionEastWestNeighbor(world, pos, c, block, dir, count, countAmt); - } - for (int c = i; c <= countAmt; c++) { - updateRailsSectionEastWestShape(world, pos, c, mainState, dir, count, countAmt); - } - /*for (int c = countAmt; c >= i; c--) { - updateRailsSectionEastWestNeighbor(world, pos, c, block, dir, count, countAmt); + if (CFSettings.reIntroduceReverseRailUpdateOrder) { + for (int c = countAmt; c >= i; c--) { + updateRailsSectionEastWestNeighbor(world, pos, c, block, dir, count, countAmt); + } + for (int c = countAmt; c >= i; c--) { + updateRailsSectionEastWestShape(world, pos, c, mainState, dir, count, countAmt); + } + } else { + for (int c = i; c <= countAmt; c++) { + updateRailsSectionEastWestNeighbor(world, pos, c, block, dir, count, countAmt); + } + for (int c = i; c <= countAmt; c++) { + updateRailsSectionEastWestShape(world, pos, c, mainState, dir, count, countAmt); + } } - for (int c = countAmt; c >= i; c--) { - updateRailsSectionEastWestShape(world, pos, c, mainState, dir, count, countAmt); - }*/ } } else { for(int i = 0; i < NORTH_SOUTH_DIR.length; ++i) { @@ -375,18 +378,21 @@ private void updateRails(boolean eastWest, World world, BlockPos pos, BlockState if (i == 1 && countAmt == 0) continue; Direction dir = NORTH_SOUTH_DIR[i]; Block block = mainState.getBlock(); - for (int c = i; c <= countAmt; c++) { - updateRailsSectionNorthSouthNeighbor(world, pos, c, block, dir, count, countAmt); - } - for (int c = i; c <= countAmt; c++) { - updateRailsSectionNorthSouthShape(world, pos, c, mainState, dir, count, countAmt); - } - /*for (int c = countAmt; c >= i; c--) { - updateRailsSectionNorthSouthNeighbor(world, pos, c, block, dir, count, countAmt); + if (CFSettings.reIntroduceReverseRailUpdateOrder) { + for (int c = countAmt; c >= i; c--) { + updateRailsSectionNorthSouthNeighbor(world, pos, c, block, dir, count, countAmt); + } + for (int c = countAmt; c >= i; c--) { + updateRailsSectionNorthSouthShape(world, pos, c, mainState, dir, count, countAmt); + } + } else { + for (int c = i; c <= countAmt; c++) { + updateRailsSectionNorthSouthNeighbor(world, pos, c, block, dir, count, countAmt); + } + for (int c = i; c <= countAmt; c++) { + updateRailsSectionNorthSouthShape(world, pos, c, mainState, dir, count, countAmt); + } } - for (int c = countAmt; c >= i; c--) { - updateRailsSectionNorthSouthShape(world, pos, c, mainState, dir, count, countAmt); - }*/ } } }