diff --git a/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java
index cc2ce878aee..e00cdc21235 100644
--- a/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java
+++ b/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java
@@ -1,7 +1,11 @@
package gregtech.api.capability.impl;
import gregtech.api.GTValues;
-import gregtech.api.capability.*;
+import gregtech.api.capability.GregtechDataCodes;
+import gregtech.api.capability.GregtechTileCapabilities;
+import gregtech.api.capability.IMultiblockController;
+import gregtech.api.capability.IMultipleTankHandler;
+import gregtech.api.capability.IWorkable;
import gregtech.api.metatileentity.MTETrait;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.multiblock.CleanroomType;
@@ -432,34 +436,53 @@ protected boolean checkCleanroomRequirement(@NotNull Recipe recipe) {
*
* - The recipe is run in parallel if possible.
* - The potentially parallel recipe is then checked to exist.
- * - If it exists, it checks if the recipe is runnable with the current inputs.
+ * - If it exists, it checks if the recipe is runnable with the inputs provided.
*
* If the above conditions are met, the recipe is engaged to be run
*
- * @param recipe the recipe to prepare
+ * @param recipe the recipe to prepare
+ * @param inputInventory the inventory to draw items from
+ * @param inputFluidInventory the fluid tanks to draw fluid from
* @return true if the recipe was successfully prepared, else false
*/
- protected boolean prepareRecipe(Recipe recipe) {
+ public boolean prepareRecipe(Recipe recipe, IItemHandlerModifiable inputInventory,
+ IMultipleTankHandler inputFluidInventory) {
recipe = Recipe.trimRecipeOutputs(recipe, getRecipeMap(), metaTileEntity.getItemOutputLimit(),
metaTileEntity.getFluidOutputLimit());
// Pass in the trimmed recipe to the parallel logic
recipe = findParallelRecipe(
recipe,
- getInputInventory(),
- getInputTank(),
+ inputInventory,
+ inputFluidInventory,
getOutputInventory(),
getOutputTank(),
getMaxParallelVoltage(),
getParallelLimit());
- if (recipe != null && setupAndConsumeRecipeInputs(recipe, getInputInventory())) {
+ if (recipe != null && setupAndConsumeRecipeInputs(recipe, inputInventory, inputFluidInventory)) {
setupRecipe(recipe);
return true;
}
return false;
}
+ /**
+ * Prepares the recipe to be run.
+ *
+ * - The recipe is run in parallel if possible.
+ * - The potentially parallel recipe is then checked to exist.
+ * - If it exists, it checks if the recipe is runnable with the current inputs.
+ *
+ * If the above conditions are met, the recipe is engaged to be run
+ *
+ * @param recipe the recipe to prepare
+ * @return true if the recipe was successfully prepared from the default inventory, else false
+ */
+ public boolean prepareRecipe(Recipe recipe) {
+ return prepareRecipe(recipe, getInputInventory(), getInputTank());
+ }
+
/**
* DO NOT use the parallelLimit field directly, EVER
*
@@ -549,11 +572,14 @@ protected static boolean areItemStacksEqual(@NotNull ItemStack stackA, @NotNull
* @param recipe - The Recipe that will be consumed from the inputs and ran in the machine
* @param importInventory - The inventory that the recipe should be consumed from.
* Used mainly for Distinct bus implementation for multiblocks to specify
- * a specific bus
+ * a specific bus, or for addons to use external inventories.
+ * @param importFluids - The tanks that the recipe should be consumed from
+ * Used currently in addons to use external tanks.
* @return - true if the recipe is successful, false if the recipe is not successful
*/
protected boolean setupAndConsumeRecipeInputs(@NotNull Recipe recipe,
- @NotNull IItemHandlerModifiable importInventory) {
+ @NotNull IItemHandlerModifiable importInventory,
+ @NotNull IMultipleTankHandler importFluids) {
this.overclockResults = calculateOverclock(recipe);
modifyOverclockPost(overclockResults, recipe.getRecipePropertyStorage());
@@ -563,7 +589,6 @@ protected boolean setupAndConsumeRecipeInputs(@NotNull Recipe recipe,
}
IItemHandlerModifiable exportInventory = getOutputInventory();
- IMultipleTankHandler importFluids = getInputTank();
IMultipleTankHandler exportFluids = getOutputTank();
// We have already trimmed outputs and chanced outputs at this time
@@ -589,6 +614,24 @@ protected boolean setupAndConsumeRecipeInputs(@NotNull Recipe recipe,
return false;
}
+ /**
+ * Determines if the provided recipe is possible to run from the provided inventory, or if there is anything
+ * preventing
+ * the Recipe from being completed.
+ *
+ * Will consume the inputs of the Recipe if it is possible to run.
+ *
+ * @param recipe - The Recipe that will be consumed from the inputs and ran in the machine
+ * @param importInventory - The inventory that the recipe should be consumed from.
+ * Used mainly for Distinct bus implementation for multiblocks to specify
+ * a specific bus
+ * @return - true if the recipe is successful, false if the recipe is not successful
+ */
+ protected boolean setupAndConsumeRecipeInputs(@NotNull Recipe recipe,
+ @NotNull IItemHandlerModifiable importInventory) {
+ return setupAndConsumeRecipeInputs(recipe, importInventory, this.getInputTank());
+ }
+
/**
* @param resultOverclock the overclock data to use. Format: {@code [EUt, duration]}.
* @return true if there is enough energy to continue recipe progress
diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/LargeTurbineWorkableHandler.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/LargeTurbineWorkableHandler.java
index 482d6c710b5..3f5dbd7c14a 100644
--- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/LargeTurbineWorkableHandler.java
+++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/LargeTurbineWorkableHandler.java
@@ -74,7 +74,7 @@ protected long boostProduction(long production) {
}
@Override
- protected boolean prepareRecipe(Recipe recipe) {
+ public boolean prepareRecipe(Recipe recipe) {
IRotorHolder rotorHolder = ((MetaTileEntityLargeTurbine) metaTileEntity).getRotorHolder();
if (rotorHolder == null || !rotorHolder.hasRotor())
return false;