-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add error logging for unified failing recipes
- Loading branch information
Showing
6 changed files
with
108 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
Common/src/main/java/com/almostreliable/unified/utils/RecipeErrorHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.almostreliable.unified.utils; | ||
|
||
import net.minecraft.resources.ResourceLocation; | ||
|
||
import com.almostreliable.unified.AlmostUnifiedCommon; | ||
import com.almostreliable.unified.unification.recipe.RecipeTransformer; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public final class RecipeErrorHandler { | ||
|
||
private static final Set<ResourceLocation> RECIPES = new HashSet<>(); | ||
|
||
private RecipeErrorHandler() {} | ||
|
||
public static void collect(RecipeTransformer.Result result, ResourceLocation recipe) { | ||
if (result.getUnifiedRecipes().contains(recipe)) { | ||
RECIPES.add(recipe); | ||
} | ||
} | ||
|
||
public static void finish() { | ||
if (!RECIPES.isEmpty()) { | ||
AlmostUnifiedCommon.LOGGER.error( | ||
"The following recipes were unified and threw exceptions when being loaded: {}", | ||
RECIPES | ||
); | ||
AlmostUnifiedCommon.LOGGER.warn( | ||
"Try to add them to the ignore list and if the problem is gone, report it to the Almost Unified developers." | ||
); | ||
} | ||
|
||
RECIPES.clear(); | ||
} | ||
} |