Skip to content

Commit

Permalink
log screen info
Browse files Browse the repository at this point in the history
  • Loading branch information
nothub committed Apr 1, 2024
1 parent 96bea14 commit 6a53959
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/main/java/lol/hub/headlessbot/Mod.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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());
}
});

Expand Down

0 comments on commit 6a53959

Please sign in to comment.