Skip to content

Commit

Permalink
close some screens
Browse files Browse the repository at this point in the history
  • Loading branch information
nothub committed Apr 1, 2024
1 parent 7055bcb commit ef24ae1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/java/lol/hub/headlessbot/Mod.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++;
Expand Down

0 comments on commit ef24ae1

Please sign in to comment.