aboutsummaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/main/java/gregtech/api/util/GT_Recipe.java14
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java11
2 files changed, 14 insertions, 11 deletions
diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java
index 2bc8985c3f..3f1022167f 100644
--- a/src/main/java/gregtech/api/util/GT_Recipe.java
+++ b/src/main/java/gregtech/api/util/GT_Recipe.java
@@ -1406,17 +1406,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> {
private GT_Recipe addRecipe(GT_Recipe recipe, double baseBurnTime){
recipe = new GT_Recipe(recipe);
- //Some recipes will have a burn time like 15.9999999 and % always rounds down
- double floatErrorCorrection = 0.0001;
- double bronzeBurnTime = baseBurnTime * 2 + floatErrorCorrection;
- bronzeBurnTime -= bronzeBurnTime % 0.05;
- double steelBurnTime = baseBurnTime * 1.5 + floatErrorCorrection;
- steelBurnTime -= steelBurnTime % 0.05;
- double titaniumBurnTime = baseBurnTime * 1.3 + floatErrorCorrection;
- titaniumBurnTime -= titaniumBurnTime % 0.05;
- double tungstensteelBurnTime = baseBurnTime * 1.2 + floatErrorCorrection;
- tungstensteelBurnTime -= tungstensteelBurnTime % 0.05;
+ double bronzeBurnTime = baseBurnTime * 2;
+ double steelBurnTime = baseBurnTime * 1.5;
+ double titaniumBurnTime = baseBurnTime * 1.3;
+ double tungstensteelBurnTime = baseBurnTime * 1.2;
recipe.setNeiDesc("Burn time in seconds:",
String.format("Bronze Boiler: %.2f", bronzeBurnTime),
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