diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/DisconnectedScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/DisconnectedScreenMixin.java index 321f112374..58800bdbfe 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/DisconnectedScreenMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/DisconnectedScreenMixin.java @@ -28,7 +28,6 @@ @Mixin(DisconnectedScreen.class) public abstract class DisconnectedScreenMixin extends Screen { - @Unique private GridWidget grid; @Unique private ButtonWidget reconnectBtn; @Unique private double time = Modules.get().get(AutoReconnect.class).time.get() * 20; @@ -37,19 +36,13 @@ protected DisconnectedScreenMixin(Text title) { } @Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/GridWidget;refreshPositions()V", shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD) - private void onInit_before(CallbackInfo info, GridWidget.Adder adder) { + private void addButtons(CallbackInfo info, GridWidget.Adder adder) { AutoReconnect autoReconnect = Modules.get().get(AutoReconnect.class); if (autoReconnect.lastServerConnection != null) { - grid = new GridWidget(); - adder.add(grid); + reconnectBtn = adder.add(new ButtonWidget.Builder(Text.literal(getText()), button -> tryConnecting()).build()); - grid.setRowSpacing(2); - GridWidget.Adder myAdder = grid.createAdder(1); - - reconnectBtn = myAdder.add(new ButtonWidget.Builder(Text.literal(getText()), button -> tryConnecting()).build()); - - myAdder.add( + adder.add( new ButtonWidget.Builder(Text.literal("Toggle Auto Reconnect"), button -> { autoReconnect.toggle(); reconnectBtn.setMessage(Text.literal(getText())); @@ -59,14 +52,6 @@ private void onInit_before(CallbackInfo info, GridWidget.Adder adder) { } } - @Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/GridWidget;refreshPositions()V", shift = At.Shift.AFTER)) - private void onInit_after(CallbackInfo info) { - if (grid != null) { - grid.refreshPositions(); - grid.forEachChild(this::addDrawableChild); - } - } - @Override public void tick() { AutoReconnect autoReconnect = Modules.get().get(AutoReconnect.class);