aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java
diff options
context:
space:
mode:
authorGlease <4586901+Glease@users.noreply.github.com>2022-12-21 14:36:51 +0800
committerGlease <4586901+Glease@users.noreply.github.com>2022-12-21 14:36:51 +0800
commit2e7809e47fc6aaa22d9ef903cf9fa8b65eb6ac8d (patch)
tree7d5f88d0b38cf2554ece54f9e7ac73d393de24de /src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java
parent9db1153928718bfa92a21b53d3f1ab297db8ae75 (diff)
downloadGT5-Unofficial-2e7809e47fc6aaa22d9ef903cf9fa8b65eb6ac8d.tar.gz
GT5-Unofficial-2e7809e47fc6aaa22d9ef903cf9fa8b65eb6ac8d.tar.bz2
GT5-Unofficial-2e7809e47fc6aaa22d9ef903cf9fa8b65eb6ac8d.zip
fix overflow
Diffstat (limited to 'src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java')
-rw-r--r--src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java28
1 files changed, 20 insertions, 8 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));
}
}
}