Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More log entries for ra2 failing #3267

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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