aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/tileentities
diff options
context:
space:
mode:
authorJohannes Gäßler <updrn@student.kit.edu>2017-04-26 23:57:10 +0200
committerJohannes Gäßler <updrn@student.kit.edu>2017-04-26 23:57:10 +0200
commitbaa9caf06bd5793ccbddd8e8335668e3edd54900 (patch)
treeea724324a5fc7f49e281e852054ba47fc0328d1d /src/main/java/gregtech/common/tileentities
parent8f4225f0b8d31931f33d18d6fcd6b43f7730a6fc (diff)
downloadGT5-Unofficial-baa9caf06bd5793ccbddd8e8335668e3edd54900.tar.gz
GT5-Unofficial-baa9caf06bd5793ccbddd8e8335668e3edd54900.tar.bz2
GT5-Unofficial-baa9caf06bd5793ccbddd8e8335668e3edd54900.zip
Eliminated rounding errors that caused fuel to burn too shortly
The Large Boiler now saves excess fuel between items, greatly improves performance of items like sticks and planks. The Large boiler now stores excess projected EU that is lost when throttling with an integrated circuit
Diffstat (limited to 'src/main/java/gregtech/common/tileentities')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java
index 4a9130c761..b3c0e8ce31 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java
@@ -24,6 +24,8 @@ public abstract class GT_MetaTileEntity_LargeBoiler
private boolean firstRun = true;
private int mSuperEfficencyIncrease = 0;
private int integratedCircuitConfig = 0; //Steam output is reduced by 1000L per config
+ private int excessFuel = 0; //Eliminate rounding errors for fuels that burn half items
+ private int excessProjectedEU = 0; //Eliminate rounding errors from throttling the boiler
public GT_MetaTileEntity_LargeBoiler(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -133,6 +135,9 @@ public abstract class GT_MetaTileEntity_LargeBoiler
if (!tInputList.isEmpty()) {
for (ItemStack tInput : tInputList) {
if ((GT_Utility.getFluidForFilledItem(tInput, true) == null) && ((this.mMaxProgresstime = runtimeBoost(GT_ModHandler.getFuelValue(tInput) / 80)) > 0)) {
+ this.excessFuel += GT_ModHandler.getFuelValue(tInput) % 80;
+ this.mMaxProgresstime += this.excessFuel / 80;
+ this.excessFuel %= 80;
this.mMaxProgresstime = adjustBurnTimeForConfig(this.mMaxProgresstime);
this.mEUt = adjustEUtForConfig(getEUt());
this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease());
@@ -264,6 +269,10 @@ public abstract class GT_MetaTileEntity_LargeBoiler
return rawBurnTime;
}
int adjustedEUt = Math.max(25, getEUt() - 25 * integratedCircuitConfig);
- return rawBurnTime * getEUt() / adjustedEUt;
+ int adjustedBurnTime = rawBurnTime * getEUt() / adjustedEUt;
+ this.excessProjectedEU += (getEUt() * rawBurnTime) - (adjustedEUt * adjustedBurnTime);
+ adjustedBurnTime += this.excessProjectedEU / adjustedEUt;
+ this.excessProjectedEU %= adjustedEUt;
+ return adjustedBurnTime;
}
} \ No newline at end of file