aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base
diff options
context:
space:
mode:
authorDavid Vierra <codewarrior@hawaii.rr.com>2018-01-28 07:03:08 -1000
committerDavid Vierra <codewarrior@hawaii.rr.com>2018-01-28 07:03:26 -1000
commitf0b2da3cc57441dc5ef468c33a68788b47f073b2 (patch)
tree8ce6438facd127456bc97b5cf1cdd243fea7d05a /src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base
parentc691dafed53cd962993df166d8d50cab535bf459 (diff)
downloadGT5-Unofficial-f0b2da3cc57441dc5ef468c33a68788b47f073b2.tar.gz
GT5-Unofficial-f0b2da3cc57441dc5ef468c33a68788b47f073b2.tar.bz2
GT5-Unofficial-f0b2da3cc57441dc5ef468c33a68788b47f073b2.zip
Make sure checkRecipeGeneric() resets the progress time and outputs.
Fixes a bug where if an input stack is of the right type but the amount is not enough, proceeds with the last successful recipe.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
index ec955410d2..7ce0a32560 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
@@ -199,18 +199,16 @@ GT_MetaTileEntity_MultiBlockBase {
return false;
}
- // Convert speed bonus to duration multiplier
- // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
- aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
- float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
- this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor);
-
// EU discount
float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
float tTotalEUt = 0.0f;
+ // Reset outputs and progress stats
this.mEUt = 0;
-
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+
// Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) {
if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
@@ -219,12 +217,18 @@ GT_MetaTileEntity_MultiBlockBase {
tTotalEUt += tRecipeEUt;
}
- this.mEUt = (int)Math.ceil(tTotalEUt);
-
if (parallelRecipes == 0) {
return false;
}
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor);
+
+ this.mEUt = (int)Math.ceil(tTotalEUt);
+
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;