From 60c2d167c863d9d061efab7e18c4df605de50a55 Mon Sep 17 00:00:00 2001 From: Lyft <127234178+Lyfts@users.noreply.github.com> Date: Wed, 2 Oct 2024 18:53:45 +0200 Subject: Fix multi fluid solidifier auto build (#3313) Co-authored-by: Martin Robertz --- .../machines/multi/MTEMultiSolidifier.java | 120 +++++++-------------- 1 file changed, 41 insertions(+), 79 deletions(-) (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiSolidifier.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiSolidifier.java index ebd939536c..0fe41c5dad 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiSolidifier.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiSolidifier.java @@ -66,17 +66,21 @@ import mcp.mobius.waila.api.IWailaDataAccessor; public class MTEMultiSolidifier extends MTEExtendedPowerMultiBlockBase implements ISurvivalConstructable { - protected final String MS_LEFT_MID = mName + "leftmid"; - protected final String MS_RIGHT_MID = mName + "rightmid"; - protected final String MS_END = mName + "end"; + private static final String MS_LEFT_MID = "leftmid"; + private static final String MS_RIGHT_MID = "rightmid"; + private static final String MS_END = "end"; - private final int PARALLELS_PER_WIDTH = 3; + private static final int PARALLELS_PER_WIDTH = 3; + private static final double DECAY_RATE = 0.025; private byte glassTier = 0; - private static final double decay_rate = 0.025; + protected int width; + private int casingAmount; + private float speedup = 1; + private int runningTickCounter = 0; - private final String STRUCTURE_PIECE_MAIN = "main"; - private final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition + private static final String STRUCTURE_PIECE_MAIN = "main"; + private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition .builder() .addShape( MS_LEFT_MID, @@ -226,59 +230,30 @@ public class MTEMultiSolidifier extends MTEExtendedPowerMultiBlockBase= 0) return built; - int tTotalWidth = Math.min(stackSize.stackSize + 1, 6); - for (int i = 1; i < tTotalWidth; i++) { - mWidth = i; - nWidth = i; - built = survivialBuildPiece(MS_LEFT_MID, stackSize, 3 + 2 * i, 4, 0, elementBudget, env, false, true); - if (built >= 0) return built; - built = survivialBuildPiece(MS_RIGHT_MID, stackSize, -2 - 2 * i, 4, 0, elementBudget, env, false, true); + int totalWidth = Math.min(stackSize.stackSize + 1, 6); + for (int i = 0; i < totalWidth; i++) { + built = survivialBuildPiece(MS_LEFT_MID, stackSize, 5 + 2 * i, 4, 0, elementBudget, env, false, true); + built += survivialBuildPiece(MS_RIGHT_MID, stackSize, -4 - 2 * i, 4, 0, elementBudget, env, false, true); if (built >= 0) return built; } - if (mWidth == tTotalWidth - 1) { - built += survivialBuildPiece( - MS_END, - stackSize, - (3 + tTotalWidth) * 2 - 4, - 4, - 0, - elementBudget, - env, - false, - true); - built += survivialBuildPiece( - MS_END, - stackSize, - (-3 - tTotalWidth) * 2 + 4, - 4, - 0, - elementBudget, - env, - false, - true); - } + built = survivialBuildPiece(MS_END, stackSize, -4 - 2 * totalWidth, 4, 0, elementBudget, env, false, true); + built += survivialBuildPiece(MS_END, stackSize, 4 + 2 * totalWidth, 4, 0, elementBudget, env, false, true); return built; } @@ -287,27 +262,23 @@ public class MTEMultiSolidifier extends MTEExtendedPowerMultiBlockBase= VoltageIndex.UMV) return true; @@ -317,7 +288,7 @@ public class MTEMultiSolidifier extends MTEExtendedPowerMultiBlockBase= (100 + mWidth * 23); + return casingAmount >= (100 + width * 23); } @Override @@ -334,38 +305,29 @@ public class MTEMultiSolidifier extends MTEExtendedPowerMultiBlockBase 1) { - tickcounts++; - if (tickcounts % 5 == 0) { - tickcounts = 0; - speedup = (float) Math.max(1, speedup - decay_rate); - } + if (!aBaseMetaTileEntity.isServerSide()) return; + if (mMaxProgresstime == 0 && speedup > 1) { + if (aTick % 5 == 0) { + speedup = (float) Math.max(1, speedup - DECAY_RATE); } } } public int getMaxParallelRecipes() { - return 4 + (mWidth * PARALLELS_PER_WIDTH) * GTUtility.getTier(this.getMaxInputVoltage()); + return 4 + (width * PARALLELS_PER_WIDTH) * GTUtility.getTier(this.getMaxInputVoltage()); } @Override -- cgit