From c0a3664bedc88f4c3e9c5f0f49c7246cca5662ae Mon Sep 17 00:00:00 2001 From: DrParanoya <158059657+DrParanoya@users.noreply.github.com> Date: Sat, 4 Jan 2025 19:42:59 +0100 Subject: [PATCH] Add a setting to hide the Auto Reconnect buttons (#5072) --- .../meteorclient/mixin/DisconnectedScreenMixin.java | 4 ++-- .../meteorclient/systems/modules/misc/AutoReconnect.java | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/DisconnectedScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/DisconnectedScreenMixin.java index 221b9d4353..4a8bab9ae1 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/DisconnectedScreenMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/DisconnectedScreenMixin.java @@ -7,10 +7,10 @@ import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.misc.AutoReconnect; -import net.minecraft.client.gui.screen.multiplayer.ConnectScreen; import net.minecraft.client.gui.screen.DisconnectedScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.TitleScreen; +import net.minecraft.client.gui.screen.multiplayer.ConnectScreen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.DirectionalLayoutWidget; import net.minecraft.text.Text; @@ -40,7 +40,7 @@ protected DisconnectedScreenMixin(Text title) { private void addButtons(CallbackInfo ci) { AutoReconnect autoReconnect = Modules.get().get(AutoReconnect.class); - if (autoReconnect.lastServerConnection != null) { + if (autoReconnect.lastServerConnection != null && !autoReconnect.button.get()) { reconnectBtn = new ButtonWidget.Builder(Text.literal(getText()), button -> tryConnecting()).build(); grid.add(reconnectBtn); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/AutoReconnect.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/AutoReconnect.java index e5e3e893ea..997f57d442 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/AutoReconnect.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/AutoReconnect.java @@ -9,6 +9,7 @@ import it.unimi.dsi.fastutil.objects.ObjectObjectImmutablePair; import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.events.world.ServerConnectBeginEvent; +import meteordevelopment.meteorclient.settings.BoolSetting; import meteordevelopment.meteorclient.settings.DoubleSetting; import meteordevelopment.meteorclient.settings.Setting; import meteordevelopment.meteorclient.settings.SettingGroup; @@ -30,6 +31,13 @@ public class AutoReconnect extends Module { .build() ); + public final Setting button = sgGeneral.add(new BoolSetting.Builder() + .name("hide-buttons") + .description("Will hide the buttons related to Auto Reconnect.") + .defaultValue(false) + .build() + ); + public Pair lastServerConnection; public AutoReconnect() {