Unknown 6 жил өмнө
parent
commit
354784604b

+ 8 - 3
src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java

@@ -13,6 +13,7 @@ import net.minecraft.item.ItemStack;
 import net.minecraft.recipe.Recipe;
 import net.minecraft.recipe.RecipeManager;
 import net.minecraft.util.Identifier;
+import org.apache.logging.log4j.Level;
 
 import java.awt.*;
 import java.util.List;
@@ -300,9 +301,13 @@ public class RecipeHelperImpl implements RecipeHelper {
         RecipeCategory category = getCategory(display.getRecipeCategory());
         List<DisplayVisibilityHandler> list = getDisplayVisibilityHandlers().stream().sorted(VISIBILITY_HANDLER_COMPARATOR).collect(Collectors.toList());
         for(DisplayVisibilityHandler displayVisibilityHandler : list) {
-            DisplayVisibility visibility = displayVisibilityHandler.handleDisplay(category, display);
-            if (visibility != DisplayVisibility.PASS)
-                return visibility == DisplayVisibility.ALWAYS_VISIBLE || visibility == DisplayVisibility.CONFIG_OPTIONAL;
+            try {
+                DisplayVisibility visibility = displayVisibilityHandler.handleDisplay(category, display);
+                if (visibility != DisplayVisibility.PASS)
+                    return visibility == DisplayVisibility.ALWAYS_VISIBLE || visibility == DisplayVisibility.CONFIG_OPTIONAL;
+            } catch (Throwable throwable) {
+                RoughlyEnoughItemsCore.LOGGER.error("[REI] Failed to check if the recipe is visible!", throwable);
+            }
         }
         return true;
     }

+ 1 - 2
src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java

@@ -44,13 +44,12 @@ public class DefaultPlugin implements REIPluginEntry {
     public static final Identifier PLUGIN = new Identifier("roughlyenoughitems", "default_plugin");
     private static final Identifier DISPLAY_TEXTURE = new Identifier("roughlyenoughitems", "textures/gui/display.png");
     private static final Identifier DISPLAY_TEXTURE_DARK = new Identifier("roughlyenoughitems", "textures/gui/display_dark.png");
+    private static final List<DefaultBrewingDisplay> BREWING_DISPLAYS = Lists.newArrayList();
     
     public static Identifier getDisplayTexture() {
         return RoughlyEnoughItemsCore.getConfigManager().getConfig().darkTheme ? DISPLAY_TEXTURE_DARK : DISPLAY_TEXTURE;
     }
     
-    private static final List<DefaultBrewingDisplay> BREWING_DISPLAYS = Lists.newArrayList();
-    
     public static void registerBrewingDisplay(DefaultBrewingDisplay display) {
         BREWING_DISPLAYS.add(display);
     }