diff options
author | Glease <4586901+Glease@users.noreply.github.com> | 2022-12-21 14:36:51 +0800 |
---|---|---|
committer | Glease <4586901+Glease@users.noreply.github.com> | 2022-12-21 14:36:51 +0800 |
commit | 2e7809e47fc6aaa22d9ef903cf9fa8b65eb6ac8d (patch) | |
tree | 7d5f88d0b38cf2554ece54f9e7ac73d393de24de | |
parent | 9db1153928718bfa92a21b53d3f1ab297db8ae75 (diff) | |
download | GT5-Unofficial-2e7809e47fc6aaa22d9ef903cf9fa8b65eb6ac8d.tar.gz GT5-Unofficial-2e7809e47fc6aaa22d9ef903cf9fa8b65eb6ac8d.tar.bz2 GT5-Unofficial-2e7809e47fc6aaa22d9ef903cf9fa8b65eb6ac8d.zip |
fix overflow
-rw-r--r-- | src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java | 28 | ||||
-rw-r--r-- | src/main/resources/assets/ggfab/lang/en_US.lang | 2 |
2 files changed, 21 insertions, 9 deletions
diff --git a/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java b/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java index 988e5ba837..499f1e18f6 100644 --- a/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java +++ b/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java @@ -419,7 +419,6 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas inputEUt += hatch.maxEUInput() * LaserHelper.getAmperes(hatch); inputVoltage = Math.min(inputVoltage, hatch.maxEUInput()); if (inputEUt < 0) - // I'd prefer bullying colen than use bigint inputEUt = Long.MAX_VALUE; } @@ -461,8 +460,6 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas for (GT_MetaTileEntity_Hatch_DataAccess hatch_dataAccess : mDataAccessHatches) { hatch_dataAccess.setActive(true); } - if (!super.onRunningTick(aStack)) - return false; if (mInputBusses.size() < currentRecipe.mInputs.length) { criticalStopMachine(); @@ -480,7 +477,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas getBaseMetaTileEntity().issueClientUpdate(); boolean foundWorking = false; - int tEUt = 0; + int working = 0; for (Slice slice : slices) { if (slice.progress >= 0) { if (!foundWorking) { @@ -489,9 +486,24 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas } } if (slice.progress > 0) - tEUt += baseEUt; + working++; } - lEUt = tEUt; + lEUt = working * baseEUt; + + if (lEUt > 0) { + // overflow again :( + lEUt = Long.MIN_VALUE; + for (int i = 0; i < working; i++) { + if (!drainEnergyInput(-baseEUt)){ + criticalStopMachine(); + return false; + } + } + } else { + if (!super.onRunningTick(aStack)) + return false; + } + if (slices[0].canStart() && getBaseMetaTileEntity().isAllowedToWork()) { if (hasAllFluids(currentRecipe)) { @@ -725,10 +737,10 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas currentTip.add(I18n.format("ggfab.waila.advassline.slice.stuck", i + 1)); } else if (progress < 0) { currentTip.add(I18n.format("ggfab.waila.advassline.slice.idle", i + 1)); - } else if (duration > 20) { + } else if (duration > 40) { currentTip.add(I18n.format("ggfab.waila.advassline.slice", i + 1, (duration - progress) / 20, duration / 20)); } else { - currentTip.add(I18n.format("ggfab.waila.advassline.slice.small", i + 1, progress)); + currentTip.add(I18n.format("ggfab.waila.advassline.slice.small", i + 1, duration - progress, duration)); } } } diff --git a/src/main/resources/assets/ggfab/lang/en_US.lang b/src/main/resources/assets/ggfab/lang/en_US.lang index 21b3462850..1bdcc6bbe9 100644 --- a/src/main/resources/assets/ggfab/lang/en_US.lang +++ b/src/main/resources/assets/ggfab/lang/en_US.lang @@ -8,7 +8,7 @@ ggfab.info.advassline.6=The EU/t cost of this machine is number of slices active ggfab.info.advassline.7=With exotic energy hatches, it can overclock beyond usual voltage tier, but will consume even more power than usual imperfect overclock. Every §2laser overclock§r will add %s to power exponent. ggfab.info.advassline.8=1 §2laser overclock§r will have 50%% recipe time and use %s%% power. 2 §2laser overclock§r will have 25%% recipe time and use %s%% (%s * %s) power. Will not overclock beyond 1 tick. Machine first tries to parallelize, then normal imperfect overclock, then §2laser overclock§r. ggfab.waila.advassline.slice=Slice #%s: %s s / %s s -ggfab.waila.advassline.slice.small=Slice #%s: %s ticks remaining +ggfab.waila.advassline.slice.small=Slice #%s: %s ticks / %s ticks ggfab.waila.advassline.slice.idle=Slice #%s: Idle ggfab.waila.advassline.slice.stuck=Slice #%s: §4STUCK ggfab.info.advassline.slice=Slice Info |