aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorBlueWeabo <ilia.iliev2005@gmail.com>2023-08-03 18:19:56 +0300
committerGitHub <noreply@github.com>2023-08-03 17:19:56 +0200
commit86501313b382363047748e5b44c86db76ebb2370 (patch)
tree75a43c46f08640ac59bb8e081e28464764ce5ed2 /src/main
parentd885f60a136f06d7872c0cbd1f9bb4d2070ab338 (diff)
downloadGT5-Unofficial-86501313b382363047748e5b44c86db76ebb2370.tar.gz
GT5-Unofficial-86501313b382363047748e5b44c86db76ebb2370.tar.bz2
GT5-Unofficial-86501313b382363047748e5b44c86db76ebb2370.zip
Fix chemical plant always thinking it has enough inputs (#711)
* Fix chemical plant always thinking it has enough inputs * make sure catalyst is damaged according to parallels
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
index b6917f0bd3..c0b3e937db 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
@@ -542,16 +542,18 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<Gregt
}
}
- private void damageCatalyst(ItemStack aStack) {
+ private void damageCatalyst(ItemStack aStack, int minParallel) {
// Awakened Draconium Coils with Tungstensteel Pipe Casings (or above) no longer consume catalysts.
- if (isCatalystDamageable()
- && (MathUtils.randFloat(0, 10000000) / 10000000f < (1.2f - (0.2 * this.mPipeCasingTier)))) {
- int damage = getDamage(aStack) + 1;
- if (damage >= getMaxCatalystDurability()) {
- addOutput(CI.getEmptyCatalyst(1));
- aStack.stackSize -= 1;
- } else {
- setDamage(aStack, damage);
+ if (!isCatalystDamageable()) return;
+ for (int i = 0; i < minParallel; i++) {
+ if (MathUtils.randFloat(0, 10000000) / 10000000f < (1.2f - (0.2 * this.mPipeCasingTier))) {
+ int damage = getDamage(aStack) + 1;
+ if (damage >= getMaxCatalystDurability()) {
+ addOutput(CI.getEmptyCatalyst(1));
+ aStack.stackSize -= 1;
+ } else {
+ setDamage(aStack, damage);
+ }
}
}
}
@@ -604,22 +606,23 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<Gregt
return new GT_ParallelHelper() {
@Override
- protected boolean tryConsumeRecipeInputs(GT_Recipe recipe, FluidStack[] fluids, ItemStack[] items) {
+ protected boolean tryConsumeRecipeInputs(GT_Recipe recipe, FluidStack[] fluids, ItemStack[] items,
+ int minParallel) {
if (catalystRecipe != null && getDamage(catalystRecipe) >= getMaxCatalystDurability()) {
return false;
}
- boolean hasInputs = super.tryConsumeRecipeInputs(recipe, fluids, items);
+ boolean hasInputs = super.tryConsumeRecipeInputs(recipe, fluids, items, minParallel);
if (hasInputs && catalystRecipe != null) {
- damageCatalyst(catalystRecipe);
+ damageCatalyst(catalystRecipe, minParallel);
}
- return true;
+ return hasInputs;
}
}.setRecipe(recipe).setItemInputs(inputItems).setFluidInputs(inputFluids)
.setAvailableEUt(availableVoltage * availableAmperage)
.setMachine(machine, protectItems, protectFluids)
.setRecipeLocked(recipeLockableMachine, isRecipeLocked).setMaxParallel(maxParallel)
- .setEUtModifier(euModifier).enableBatchMode(batchSize).enableConsumption()
- .enableOutputCalculation();
+ .setEUtModifier(euModifier).enableBatchMode(batchSize).setConsumption(true)
+ .setOutputCalculation(true);
}
};
}