From 614a8ef48584740ddbcd6ece4f7e7bbe139e755b Mon Sep 17 00:00:00 2001 From: shedaniel Date: Fri, 28 Aug 2020 20:01:47 +0800 Subject: Detect a good optifabric instance, it should support Chocohead/OptiFabric Signed-off-by: shedaniel --- .../src/main/java/me/shedaniel/rei/impl/ScreenHelper.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ScreenHelper.java') diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ScreenHelper.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ScreenHelper.java index 60914d080..1352d7656 100644 --- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ScreenHelper.java +++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ScreenHelper.java @@ -260,7 +260,15 @@ public class ScreenHelper implements ClientModInitializer, REIHelper { public void onInitializeClient() { ClothClientHooks.SCREEN_INIT_PRE.register((client, screen, screenHooks) -> { if ((!RoughlyEnoughItemsState.getErrors().isEmpty() || !RoughlyEnoughItemsState.getWarnings().isEmpty()) && !(screen instanceof WarningAndErrorScreen)) { - WarningAndErrorScreen warningAndErrorScreen = WarningAndErrorScreen.INSTANCE.get(); + WarningAndErrorScreen warningAndErrorScreen = new WarningAndErrorScreen("initialization", RoughlyEnoughItemsState.getWarnings(), RoughlyEnoughItemsState.getErrors(), (parent) -> { + if (RoughlyEnoughItemsState.getErrors().isEmpty()) { + RoughlyEnoughItemsState.clear(); + RoughlyEnoughItemsState.continues(); + Minecraft.getInstance().setScreen(parent); + } else { + Minecraft.getInstance().stop(); + } + }); warningAndErrorScreen.setParent(screen); try { if (client.screen != null) client.screen.removed(); -- cgit