From 86501313b382363047748e5b44c86db76ebb2370 Mon Sep 17 00:00:00 2001 From: BlueWeabo Date: Thu, 3 Aug 2023 18:19:56 +0300 Subject: 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 --- .../chemplant/GregtechMTE_ChemicalPlant.java | 33 ++++++++++++---------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src') 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= 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= 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); } }; } -- cgit