From 6a5395956258e4dc3f2b519dd2dd032ac0304644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20H=C3=BCbner?= Date: Tue, 2 Apr 2024 01:15:26 +0200 Subject: [PATCH] log screen info --- src/main/java/lol/hub/headlessbot/Mod.java | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/lol/hub/headlessbot/Mod.java b/src/main/java/lol/hub/headlessbot/Mod.java index 9dc9414..25b1352 100644 --- a/src/main/java/lol/hub/headlessbot/Mod.java +++ b/src/main/java/lol/hub/headlessbot/Mod.java @@ -14,8 +14,8 @@ import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents; -import net.minecraft.client.gui.screen.AccessibilityOnboardingScreen; -import net.minecraft.client.gui.screen.TitleScreen; +import net.minecraft.client.gui.screen.*; +import net.minecraft.client.gui.screen.multiplayer.ConnectScreen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerWarningScreen; import net.minecraft.util.math.BlockPos; @@ -59,14 +59,24 @@ public void onInitializeClient() { } ScreenEvents.AFTER_INIT.register((client, screen, scaledWidth, scaledHeight) -> { - if (screen instanceof AccessibilityOnboardingScreen) { + if (screen instanceof AccessibilityOnboardingScreen sc) { Log.info("Closing AccessibilityOnboardingScreen"); screen.close(); - } else if (screen instanceof MultiplayerWarningScreen) { + } else if (screen instanceof MultiplayerWarningScreen sc) { Log.info("Closing MultiplayerWarningScreen"); screen.close(); + } else if (screen instanceof ConnectScreen) { + Log.info("Connecting ..."); + } else if (screen instanceof DisconnectedScreen) { + Log.info("Disconnecting ..."); + } else if (screen instanceof DownloadingTerrainScreen) { + Log.info("Downloading terrain ..."); + } else if (screen instanceof ProgressScreen) { + Log.info("Awaiting progress ..."); + } else if (screen instanceof MessageScreen sc) { + Log.info("Showing mssage: %s", sc.getTitle().getString()); } else { - Log.info("Client is in screen: %s", screen.getClass().getSimpleName()); + Log.info("Showing screen: %s", screen.getClass().getSimpleName()); } });