diff options
Diffstat (limited to 'src/main/java/gregtech/api')
3 files changed, 54 insertions, 3 deletions
diff --git a/src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java b/src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java index f162c892ee..4dc0b80b93 100644 --- a/src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java +++ b/src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java @@ -49,10 +49,19 @@ public final class CheckRecipeResultRegistry { */ public static final CheckRecipeResult NO_RECIPE = SimpleCheckRecipeResult.ofFailure("no_recipe"); /** - * Cannot process recipe because output is full. + * @deprecated Use either of {@link #ITEM_OUTPUT_FULL} or {@link #FLUID_OUTPUT_FULL}. */ + @Deprecated public static final CheckRecipeResult OUTPUT_FULL = SimpleCheckRecipeResult.ofFailure("output_full"); /** + * Cannot process recipe because item output is full. + */ + public static final CheckRecipeResult ITEM_OUTPUT_FULL = SimpleCheckRecipeResult.ofFailure("item_output_full"); + /** + * Cannot process recipe because fluid output is full. + */ + public static final CheckRecipeResult FLUID_OUTPUT_FULL = SimpleCheckRecipeResult.ofFailure("fluid_output_full"); + /** * Default unknown state. */ public static final CheckRecipeResult NONE = SimpleCheckRecipeResult.ofFailure("none"); diff --git a/src/main/java/gregtech/api/util/GT_ParallelHelper.java b/src/main/java/gregtech/api/util/GT_ParallelHelper.java index 0f0dc4549f..e836122f37 100644 --- a/src/main/java/gregtech/api/util/GT_ParallelHelper.java +++ b/src/main/java/gregtech/api/util/GT_ParallelHelper.java @@ -341,6 +341,9 @@ public class GT_ParallelHelper { * Called by build(). Determines the parallels and everything else that needs to be done at build time */ protected void determineParallel() { + if (maxParallel <= 0) { + return; + } if (itemInputs == null) { itemInputs = new ItemStack[0]; } @@ -412,8 +415,12 @@ public class GT_ParallelHelper { .setMaxParallel(maxParallel) .build(); maxParallel = Math.min(voidProtectionHelper.getMaxParallel(), maxParallel); - if (maxParallel <= 0) { - result = CheckRecipeResultRegistry.OUTPUT_FULL; + if (voidProtectionHelper.isItemFull()) { + result = CheckRecipeResultRegistry.ITEM_OUTPUT_FULL; + return; + } + if (voidProtectionHelper.isFluidFull()) { + result = CheckRecipeResultRegistry.FLUID_OUTPUT_FULL; return; } } diff --git a/src/main/java/gregtech/api/util/VoidProtectionHelper.java b/src/main/java/gregtech/api/util/VoidProtectionHelper.java index 440d8e63ef..3a41bba934 100644 --- a/src/main/java/gregtech/api/util/VoidProtectionHelper.java +++ b/src/main/java/gregtech/api/util/VoidProtectionHelper.java @@ -36,6 +36,14 @@ public class VoidProtectionHelper { */ private int maxParallel = 1; /** + * If item output is full. + */ + private boolean isItemFull; + /** + * If fluid output is full. + */ + private boolean isFluidFull; + /** * The item outputs to check */ private ItemStack[] itemOutputs; @@ -111,6 +119,26 @@ public class VoidProtectionHelper { } /** + * @return If the calculation resulted in item output being full. + */ + public boolean isItemFull() { + if (!built) { + throw new IllegalStateException("Tried to get isItemFull before building"); + } + return isItemFull; + } + + /** + * @return If the calculation resulted in fluid output being full. + */ + public boolean isFluidFull() { + if (!built) { + throw new IllegalStateException("Tried to get isFluidFull before building"); + } + return isFluidFull; + } + + /** * Called by {@link #build()}. Determines the parallels and everything else that needs to be done at build time */ private void determineParallel() { @@ -125,9 +153,16 @@ public class VoidProtectionHelper { // to allow more involved setting for void protections (see ComplexParallelProcessingLogic) if (protectExcessItem && itemOutputs.length > 0 && !machine.canDumpItemToME()) { maxParallel = Math.min(calculateMaxItemParallels(), maxParallel); + if (maxParallel <= 0) { + isItemFull = true; + return; + } } if (protectExcessFluid && fluidOutputs.length > 0 && !machine.canDumpFluidToME()) { maxParallel = Math.min(calculateMaxFluidParallels(), maxParallel); + if (maxParallel <= 0) { + isFluidFull = true; + } } } |