mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-12 00:17:51 +00:00
Add more error message for crash with recipe lookup (#345)
This commit is contained in:
1 parent
249cb2b308
commit
3fc576b6fc
3 files changed
+18
-4
No files matched your search
@@ -4,6 +4,7 @@ import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -38,7 +39,10 @@ public class GuiCraftingRecipe extends GuiRecipe<ICraftingHandler> {
|
||||
final RecipeHandlerQuery<ICraftingHandler> recipeQuery = new RecipeHandlerQuery<>(
|
||||
h -> h.getRecipeHandler(outputId, results),
|
||||
craftinghandlers,
|
||||
serialCraftingHandlers);
|
||||
serialCraftingHandlers,
|
||||
"Error while looking up crafting recipe",
|
||||
"outputId: " + outputId,
|
||||
"results: " + Arrays.toString(results));
|
||||
|
||||
final ArrayList<ICraftingHandler> handlers = recipeQuery.runWithProfiling("recipe.concurrent.crafting");
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
@@ -16,7 +17,10 @@ public class GuiUsageRecipe extends GuiRecipe<IUsageHandler> {
|
||||
RecipeHandlerQuery<IUsageHandler> recipeQuery = new RecipeHandlerQuery<>(
|
||||
h -> getUsageOrCatalystHandler(h, inputId, ingredients),
|
||||
usagehandlers,
|
||||
serialUsageHandlers);
|
||||
serialUsageHandlers,
|
||||
"Error while looking up usage recipe",
|
||||
"inputId: " + inputId,
|
||||
"ingredients: " + Arrays.toString(ingredients));
|
||||
ArrayList<IUsageHandler> handlers = recipeQuery.runWithProfiling("recipe.concurrent.usage");
|
||||
if (handlers.isEmpty()) return false;
|
||||
|
||||
|
||||
@@ -21,11 +21,14 @@ class RecipeHandlerQuery<T extends IRecipeHandler> {
|
||||
private final Function<T, T> recipeHandlerFunction;
|
||||
private final List<T> recipeHandlers;
|
||||
private final List<T> serialRecipeHandlers;
|
||||
private final String[] errorMessage;
|
||||
|
||||
RecipeHandlerQuery(Function<T, T> recipeHandlerFunction, List<T> recipeHandlers, List<T> serialRecipeHandlers) {
|
||||
RecipeHandlerQuery(Function<T, T> recipeHandlerFunction, List<T> recipeHandlers, List<T> serialRecipeHandlers,
|
||||
String... errorMessage) {
|
||||
this.recipeHandlerFunction = recipeHandlerFunction;
|
||||
this.recipeHandlers = recipeHandlers;
|
||||
this.serialRecipeHandlers = serialRecipeHandlers;
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
ArrayList<T> runWithProfiling(String profilerSection) {
|
||||
@@ -62,7 +65,10 @@ class RecipeHandlerQuery<T extends IRecipeHandler> {
|
||||
.get();
|
||||
}
|
||||
|
||||
private static void displayRecipeLookupError(Exception e) {
|
||||
private void displayRecipeLookupError(Exception e) {
|
||||
for (String message : errorMessage) {
|
||||
NEIClientConfig.logger.error(message);
|
||||
}
|
||||
e.printStackTrace();
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if (player != null) {
|
||||
|
||||
Reference in new issue
Block a user