From 8160d7faf95b730e46e9fcde5355a84b212e6c6c Mon Sep 17 00:00:00 2001 From: chochem <40274384+chochem@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:56:12 +0100 Subject: [PATCH 1/2] log entries for ra2 failing --- .../gregtech/api/recipe/RecipeMapBackend.java | 15 +++++++++--- .../gregtech/api/util/GTRecipeBuilder.java | 24 +++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) 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..1852aca1f56 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.print("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.print("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; From 835729c043f10a07dd94acb3fb9c2d30e8f1f35e Mon Sep 17 00:00:00 2001 From: chochem <40274384+chochem@users.noreply.github.com> Date: Mon, 23 Sep 2024 20:00:07 +0100 Subject: [PATCH 2/2] better format --- src/main/java/gregtech/api/util/GTRecipeBuilder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/gregtech/api/util/GTRecipeBuilder.java b/src/main/java/gregtech/api/util/GTRecipeBuilder.java index 1852aca1f56..69890e564df 100644 --- a/src/main/java/gregtech/api/util/GTRecipeBuilder.java +++ b/src/main/java/gregtech/api/util/GTRecipeBuilder.java @@ -216,7 +216,7 @@ public static void handleInvalidRecipeLowFluids() { return; } // place a breakpoint here to catch all these issues - GTLog.err.print("invalid recipe: not enough input fluids"); + GTLog.err.println("invalid recipe: not enough input fluids"); new IllegalArgumentException().printStackTrace(GTLog.err); if (PANIC_MODE_INVALID) { throw new IllegalArgumentException("invalid recipe"); @@ -228,7 +228,7 @@ public static void handleInvalidRecipeLowItems() { return; } // place a breakpoint here to catch all these issues - GTLog.err.print("invalid recipe: not enough input items"); + GTLog.err.println("invalid recipe: not enough input items"); new IllegalArgumentException().printStackTrace(GTLog.err); if (PANIC_MODE_INVALID) { throw new IllegalArgumentException("invalid recipe");