From ef24ae16d0d1d06a4d61f10f26b4e7f533ab5979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20H=C3=BCbner?= Date: Tue, 2 Apr 2024 00:28:18 +0200 Subject: [PATCH] close some screens --- src/main/java/lol/hub/headlessbot/Mod.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/lol/hub/headlessbot/Mod.java b/src/main/java/lol/hub/headlessbot/Mod.java index 15ce68c..dda034f 100644 --- a/src/main/java/lol/hub/headlessbot/Mod.java +++ b/src/main/java/lol/hub/headlessbot/Mod.java @@ -13,6 +13,10 @@ import net.fabricmc.api.ModInitializer; 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.multiplayer.MultiplayerWarningScreen; import net.minecraft.util.math.BlockPos; import java.io.IOException; @@ -54,6 +58,18 @@ public void onInitializeClient() { throw new IllegalStateException(ex.getMessage()); } + ScreenEvents.AFTER_INIT.register((client, screen, scaledWidth, scaledHeight) -> { + if (screen instanceof AccessibilityOnboardingScreen) { + Log.info("Closing AccessibilityOnboardingScreen"); + screen.close(); + } else if (screen instanceof MultiplayerWarningScreen) { + Log.info("Closing MultiplayerWarningScreen"); + screen.close(); + } else if (screen instanceof TitleScreen) { + Log.info("Client is in TitleScreen"); + } + }); + ClientTickEvents.END_CLIENT_TICK.register(client -> { if (client.player == null || client.world == null) return; ticksOnline++;