aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Xizhi <60341015+GlodBlock@users.noreply.github.com>2021-12-20 02:02:09 +0800
committerGitHub <noreply@github.com>2021-12-19 19:02:09 +0100
commit9d091aa47ee71ddd6dc21b387bbd865fd54fcc4f (patch)
tree8803a06ab54d1b0eedcaae859ddc6c36d6130d2a
parente9a9ffe767d617f47a8376e268f0d438b132f78f (diff)
downloadGT5-Unofficial-9d091aa47ee71ddd6dc21b387bbd865fd54fcc4f.tar.gz
GT5-Unofficial-9d091aa47ee71ddd6dc21b387bbd865fd54fcc4f.tar.bz2
GT5-Unofficial-9d091aa47ee71ddd6dc21b387bbd865fd54fcc4f.zip
fix energy drain logic (#72)
fix https://github.com/GTNewHorizons/Dupes-Exploits-GTNH/issues/19 Former-commit-id: c6803ac0d09a412e6afcb8f41a09888321d759fa
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/helper/TecTechUtils.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/helper/TecTechUtils.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/helper/TecTechUtils.java
index bc28090155..735b7dbe53 100644
--- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/helper/TecTechUtils.java
+++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/helper/TecTechUtils.java
@@ -79,18 +79,20 @@ public class TecTechUtils {
if (allTheEu < aEU)
return false;
+ if (hatches == 0) return false;
+
long euperhatch = aEU / hatches;
- boolean hasDrained = false;
+ boolean hasDrained = true;
for (GT_MetaTileEntity_Hatch_Energy tHatch : multi.getVanillaEnergyHatches())
- hasDrained |= tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euperhatch, false);
+ hasDrained &= tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euperhatch, false);
for (GT_MetaTileEntity_Hatch_EnergyTunnel tHatch : multi.getTecTechEnergyTunnels())
- hasDrained |= tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euperhatch, false);
+ hasDrained &= tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euperhatch, false);
for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : multi.getTecTechEnergyMultis())
- hasDrained |= tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euperhatch, false);
+ hasDrained &= tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euperhatch, false);
return hasDrained && (multi.getVanillaEnergyHatches().size() > 0 || multi.getTecTechEnergyTunnels().size() > 0 || multi.getTecTechEnergyMultis().size() > 0);
}
@@ -146,4 +148,4 @@ public class TecTechUtils {
public static long getEUPerTickFromLaser(GT_MetaTileEntity_Hatch_EnergyTunnel tHatch) {
return tHatch.Amperes * tHatch.maxEUInput() - (tHatch.Amperes / 20);
}
-} \ No newline at end of file
+}