diff --git a/src/main/java/gregtech/api/recipe/RecipeMapBackend.java b/src/main/java/gregtech/api/recipe/RecipeMapBackend.java index 1122eaf869e..c1f8afffebd 100644 --- a/src/main/java/gregtech/api/recipe/RecipeMapBackend.java +++ b/src/main/java/gregtech/api/recipe/RecipeMapBackend.java @@ -2,6 +2,8 @@ import static gregtech.api.util.GTRecipeBuilder.ENABLE_COLLISION_CHECK; import static gregtech.api.util.GTRecipeBuilder.handleInvalidRecipe; +import static gregtech.api.util.GTRecipeBuilder.handleInvalidRecipeLowFluids; +import static gregtech.api.util.GTRecipeBuilder.handleInvalidRecipeLowItems; import static gregtech.api.util.GTRecipeBuilder.handleRecipeCollision; import static gregtech.api.util.GTUtility.areStacksEqualOrNull; @@ -172,14 +174,21 @@ protected Collection doAdd(GTRecipeBuilder builder) { Iterable recipes = properties.recipeEmitter.apply(builder); Collection ret = new ArrayList<>(); for (GTRecipe recipe : recipes) { - if (recipe.mFluidInputs.length < properties.minFluidInputs - || recipe.mInputs.length < properties.minItemInputs) { + if (recipe.mInputs.length < properties.minItemInputs) { + handleInvalidRecipeLowItems(); + return Collections.emptyList(); + } + if (recipe.mFluidInputs.length < properties.minFluidInputs) { + handleInvalidRecipeLowFluids(); return Collections.emptyList(); } if (properties.recipeTransformer != null) { recipe = properties.recipeTransformer.apply(recipe); } - if (recipe == null) continue; + if (recipe == null) { + handleInvalidRecipe(); + continue; + } if (builder.isCheckForCollision() && ENABLE_COLLISION_CHECK && checkCollision(recipe)) { handleCollision(recipe); continue; diff --git a/src/main/java/gregtech/api/util/GTRecipeBuilder.java b/src/main/java/gregtech/api/util/GTRecipeBuilder.java index 1426c1c2648..69890e564df 100644 --- a/src/main/java/gregtech/api/util/GTRecipeBuilder.java +++ b/src/main/java/gregtech/api/util/GTRecipeBuilder.java @@ -211,6 +211,30 @@ public static void handleInvalidRecipe() { } } + public static void handleInvalidRecipeLowFluids() { + if (!DEBUG_MODE_INVALID && !PANIC_MODE_INVALID) { + return; + } + // place a breakpoint here to catch all these issues + GTLog.err.println("invalid recipe: not enough input fluids"); + new IllegalArgumentException().printStackTrace(GTLog.err); + if (PANIC_MODE_INVALID) { + throw new IllegalArgumentException("invalid recipe"); + } + } + + public static void handleInvalidRecipeLowItems() { + if (!DEBUG_MODE_INVALID && !PANIC_MODE_INVALID) { + return; + } + // place a breakpoint here to catch all these issues + GTLog.err.println("invalid recipe: not enough input items"); + new IllegalArgumentException().printStackTrace(GTLog.err); + if (PANIC_MODE_INVALID) { + throw new IllegalArgumentException("invalid recipe"); + } + } + public static void handleRecipeCollision(String details) { if (!DEBUG_MODE_COLLISION && !PANIC_MODE_COLLISION) { return;