diff options
author | BlueWeabo <ilia.iliev2005@gmail.com> | 2023-07-28 13:13:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-28 12:13:57 +0200 |
commit | 4647e2e8be384582ad09c4f97a4c50dff4e05e4b (patch) | |
tree | 24093c64b1c8f8e700b12efedb0c197ca8a1a62e /src/main/java/gregtech/api/metatileentity/implementations | |
parent | c82e45b0aa87ba9e982a770fab08040d9e6d9459 (diff) | |
download | GT5-Unofficial-4647e2e8be384582ad09c4f97a4c50dff4e05e4b.tar.gz GT5-Unofficial-4647e2e8be384582ad09c4f97a4c50dff4e05e4b.tar.bz2 GT5-Unofficial-4647e2e8be384582ad09c4f97a4c50dff4e05e4b.zip |
Add more API to ParallelHelper and rework OverclockCalculator (#2185)
* refactor OC calc
* somewhat refactor parallel helper
* fix PA not OCing correctly
no clue why it wasn't using super and then setting the duration again.
* make use of new api to make fusion cleaner
* make batch mode actually dynamic
* add another reason for 0 parallel
* move variables around to try and group them together
* address reviews
* add overclocking past 1 tick by adding parallels
* add null check and make a basic calculator to prevent npe
* check null recipeMap supplier
* address reviews
* addressing of reviews
* make it possible to call some OverclockCalculator methods through static methods
* address reviews
* make sure one doesn't get too many OCs when calculatin under 1 tick
* add api for custom duration under one tick and fix batch mode doing 0 ticking
* fix not calculating duration under 1 tick correctly
* spotless
* try to have correct eut consumption
* address review
* make sure mk5 fusion is said in nei
* fix eutCalculating under one tick way too much and address reviews
* remove roundUp voltage
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity/implementations')
2 files changed, 20 insertions, 3 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java index 938423012c..5b5c848ad5 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java @@ -210,8 +210,9 @@ public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T extends GT @Override protected void setProcessingLogicPower(ProcessingLogic logic) { - logic.setAvailableVoltage(GT_Utility.roundDownVoltage(getAverageInputVoltage())); + logic.setAvailableVoltage(getAverageInputVoltage()); logic.setAvailableAmperage(getMaxInputAmps()); + logic.setAmperageOC(true); } @Override @@ -295,14 +296,17 @@ public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T extends GT return GT_ExoticEnergyInputHelper.getMaxInputVoltageMulti(getExoticAndNormalEnergyHatchList()); } + @Override public long getAverageInputVoltage() { return GT_ExoticEnergyInputHelper.getAverageInputVoltageMulti(getExoticAndNormalEnergyHatchList()); } + @Override public long getMaxInputAmps() { return GT_ExoticEnergyInputHelper.getMaxWorkingInputAmpsMulti(getExoticAndNormalEnergyHatchList()); } + @Override public long getMaxInputEu() { return GT_ExoticEnergyInputHelper.getTotalEuMulti(getExoticAndNormalEnergyHatchList()); } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index d427e99d4e..2f84151af9 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -786,8 +786,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity } protected void setProcessingLogicPower(ProcessingLogic logic) { - logic.setAvailableVoltage(GT_Utility.roundDownVoltage(getMaxInputVoltage())); - logic.setAvailableAmperage(1); + logic.setAvailableVoltage(getAverageInputVoltage()); + logic.setAvailableAmperage(getMaxInputAmps()); + logic.setAmperageOC(mEnergyHatches.size() != 1); } protected int getMaxBatchSize() { @@ -1010,6 +1011,18 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity return rVoltage; } + public long getAverageInputVoltage() { + return GT_ExoticEnergyInputHelper.getAverageInputVoltageMulti(mEnergyHatches); + } + + public long getMaxInputAmps() { + return GT_ExoticEnergyInputHelper.getMaxWorkingInputAmpsMulti(mEnergyHatches); + } + + public long getMaxInputEu() { + return GT_ExoticEnergyInputHelper.getTotalEuMulti(mEnergyHatches); + } + /** * Sums up max input EU/t of energy hatches, amperage included. */ |