aboutsummaryrefslogtreecommitdiff
path: root/loader
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2023-02-25 19:53:41 +0900
committersyeyoung <cyoung06@naver.com>2023-02-25 19:53:41 +0900
commit01dfac23ce5a888009b6a865d023a9e094726780 (patch)
tree742b2601e0bdcc0efd97b42570db43b6c85653ad /loader
parente5c38c8c7483b9b64b94ec8d5702ab1038e558e5 (diff)
downloadSkyblock-Dungeons-Guide-01dfac23ce5a888009b6a865d023a9e094726780.tar.gz
Skyblock-Dungeons-Guide-01dfac23ce5a888009b6a865d023a9e094726780.tar.bz2
Skyblock-Dungeons-Guide-01dfac23ce5a888009b6a865d023a9e094726780.zip
- Fix GuiDisplayer not working sometimes
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'loader')
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiDisplayer.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiDisplayer.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiDisplayer.java
index ad942ffb..2b6acdb4 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiDisplayer.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiDisplayer.java
@@ -35,14 +35,14 @@ public class GuiDisplayer {
private Queue<GuiScreen> guiScreensToShow = new LinkedList<>();
private boolean isMcLoaded;
-
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onGuiOpen(GuiOpenEvent guiOpenEvent) {
- if (guiOpenEvent.gui instanceof GuiMainMenu) {
- isMcLoaded = true;
+ isMcLoaded = true;
+ if (Minecraft.getMinecraft().currentScreen == guiScreensToShow.peek()) {
+ guiScreensToShow.poll();
}
- if (isMcLoaded && !guiScreensToShow.isEmpty()) {
- GuiScreen gui = guiScreensToShow.poll();
+ if (!guiScreensToShow.isEmpty()) {
+ GuiScreen gui = guiScreensToShow.peek();
if (gui == null) return;
guiOpenEvent.gui = gui;
}
@@ -53,9 +53,11 @@ public class GuiDisplayer {
if (!guiScreensToShow.contains(specialGuiScreen))
guiScreensToShow.add(specialGuiScreen);
if (isMcLoaded && Minecraft.getMinecraft().isCallingFromMinecraftThread()) {
- Minecraft.getMinecraft().displayGuiScreen(null);
+ if (guiScreensToShow.size() == 1)
+ Minecraft.getMinecraft().displayGuiScreen(guiScreensToShow.peek());
} else if (isMcLoaded) {
- Minecraft.getMinecraft().addScheduledTask(() -> Minecraft.getMinecraft().displayGuiScreen(null));
+ if (guiScreensToShow.size() == 1)
+ Minecraft.getMinecraft().addScheduledTask(() -> Minecraft.getMinecraft().displayGuiScreen(guiScreensToShow.peek()));
}
}
}