Skip to content

Commit

Permalink
More log entries for ra2 failing (#3267)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Robertz <dream-master@gmx.net>
  • Loading branch information
chochem and Dream-Master committed Sep 23, 2024
1 parent 1abc736 commit 2368c35
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/main/java/gregtech/api/recipe/RecipeMapBackend.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -172,14 +174,21 @@ protected Collection<GTRecipe> doAdd(GTRecipeBuilder builder) {
Iterable<? extends GTRecipe> recipes = properties.recipeEmitter.apply(builder);
Collection<GTRecipe> 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;
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/gregtech/api/util/GTRecipeBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2368c35

Please sign in to comment.