diff options
| author | Unknown <shekwancheung0528@gmail.com> | 2019-06-04 13:14:53 +0800 |
|---|---|---|
| committer | Unknown <shekwancheung0528@gmail.com> | 2019-06-04 13:14:53 +0800 |
| commit | a1480e28813b4fc9f6d4f8ce252dd5a355c00855 (patch) | |
| tree | f741aece04eba01118f45318c676c1181f5e03c5 | |
| parent | 7689bdbb42ad10b2ad99e2bae55ddaceac15bca7 (diff) | |
| download | RoughlyEnoughItems-a1480e28813b4fc9f6d4f8ce252dd5a355c00855.tar.gz RoughlyEnoughItems-a1480e28813b4fc9f6d4f8ce252dd5a355c00855.tar.bz2 RoughlyEnoughItems-a1480e28813b4fc9f6d4f8ce252dd5a355c00855.zip | |
Should not crash now
| -rw-r--r-- | src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java | 11 | ||||
| -rw-r--r-- | src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java | 3 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java b/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java index ec922d4c8..9c4b21ed5 100644 --- a/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java +++ b/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; } diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java b/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java index b73151a93..c7f199078 100644 --- a/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java +++ b/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); } |
