diff options
author | BlueWeabo <ilia.iliev2005@gmail.com> | 2023-08-10 11:40:38 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-10 10:40:38 +0200 |
commit | 1311f59453d42bd36532d1c0c2580a5b56e3f7b1 (patch) | |
tree | 36782b0fa11f27aad65de1b0ff6435e599b5f470 /src/main/java/gregtech/api/util | |
parent | 03ca60ddc5a1062a30db8a046065a29327d0d7bd (diff) | |
download | GT5-Unofficial-1311f59453d42bd36532d1c0c2580a5b56e3f7b1.tar.gz GT5-Unofficial-1311f59453d42bd36532d1c0c2580a5b56e3f7b1.tar.bz2 GT5-Unofficial-1311f59453d42bd36532d1c0c2580a5b56e3f7b1.zip |
Fix PAs overclocking ulv recipes too much (#2220)
* fix PAs overclocking ulv recipes too much
* make sure we save the returned value
Diffstat (limited to 'src/main/java/gregtech/api/util')
-rw-r--r-- | src/main/java/gregtech/api/util/GT_OverclockCalculator.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/gregtech/api/util/GT_OverclockCalculator.java b/src/main/java/gregtech/api/util/GT_OverclockCalculator.java index 0ca9bf3f46..9a1ad267b0 100644 --- a/src/main/java/gregtech/api/util/GT_OverclockCalculator.java +++ b/src/main/java/gregtech/api/util/GT_OverclockCalculator.java @@ -4,6 +4,8 @@ import java.util.function.Supplier; import javax.annotation.Nonnull; +import gregtech.api.enums.GT_Values; + public class GT_OverclockCalculator { private static final double LOG4 = Math.log(4); @@ -382,12 +384,25 @@ public class GT_OverclockCalculator { private void calculateOverclock() { if (noOverclock) { - calculateFinalRecipeEUt(calculateHeatDiscountMultiplier()); + recipeVoltage = calculateFinalRecipeEUt(calculateHeatDiscountMultiplier()); return; } if (laserOC && amperageOC) { throw new IllegalStateException("Tried to calculate overclock with both laser and amperage overclocking"); } + // ULV recipes are annoying in that those under 8 eut will overclock extra if there is too much amperage for + // them + // And those at 2 eut or 1 eut would overclock one extra more. + if (!amperageOC) { + if (recipeVoltage <= GT_Values.V[0]) { + // What we check here is to be able to remove extra amperage on the machine and also make sure one + // doesn't get more amperage from it + long oldMachineAmperage = machineAmperage; + machineAmperage = recipeVoltage <= 2 ? Math.max(parallel / machineAmperage, 1) + : Math.max(parallel * 4 / machineAmperage, 1); + machineAmperage = Math.min(machineAmperage, oldMachineAmperage); + } + } double heatDiscountMultiplier = calculateHeatDiscountMultiplier(); duration = (int) Math.ceil(duration * speedBoost); if (heatOC) { |