diff --git a/fabric/src/de/chaoscaot/altauth/fabric/TrustServerScreen.java b/fabric/src/de/chaoscaot/altauth/fabric/TrustServerScreen.java index 44c5eda..9005051 100644 --- a/fabric/src/de/chaoscaot/altauth/fabric/TrustServerScreen.java +++ b/fabric/src/de/chaoscaot/altauth/fabric/TrustServerScreen.java @@ -10,6 +10,8 @@ import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.screen.ScreenTexts; import net.minecraft.text.Text; +import java.util.function.Supplier; + public class TrustServerScreen extends ConfirmScreen { private static final Text FORCE_MOJANG = Text.translatable("gui.altauth.confirm.force_mojang"); private static final Text TRUST_ONCE = Text.translatable("gui.altauth.confirm.once"); @@ -25,24 +27,22 @@ public class TrustServerScreen extends ConfirmScreen { @Override protected void addButtons(int y) { - this.addDrawableChild(new ButtonWidget(this.width / 2 - 155, y, 150, 20, this.yesText, (button) -> { + this.addDrawableChild(ButtonWidget.builder(this.yesText, button -> { ClientConfig.INSTANCE.allowedServers.add(server); ClientConfig.INSTANCE.save(); ConnectScreen.connect(parent, client, AltAuth.address, null); - })); - this.addDrawableChild(new ButtonWidget(this.width / 2 + 5, y, 150, 20, FORCE_MOJANG, (button) -> { + }).dimensions(this.width / 2 - 155, y, 150, 20).build()); + this.addDrawableChild(ButtonWidget.builder(FORCE_MOJANG, button -> { ClientConfig.INSTANCE.forcedMojang.add(AltAuth.address.getAddress()); ClientConfig.INSTANCE.save(); ConnectScreen.connect(parent, client, AltAuth.address, null); - })); - this.addDrawableChild(new ButtonWidget(this.width / 2 - 155, y + 25, 150, 20, TRUST_ONCE, (button) -> { + }).dimensions(this.width / 2 + 5, y, 150, 20).build()); + this.addDrawableChild(ButtonWidget.builder(TRUST_ONCE, button -> { AltAuth.trustOnce = true; ConnectScreen.connect(parent, client, AltAuth.address, null); - })); - this.addDrawableChild(new ButtonWidget(this.width / 2 + 5, y + 25, 150, 20, this.noText, (button) -> { - client.setScreen(parent); - })); + }).dimensions(this.width / 2 - 155, y + 25, 150, 20).build()); + this.addDrawableChild(ButtonWidget.builder(this.noText, button -> client.setScreen(parent)).dimensions(this.width / 2 + 5, y + 25, 150, 20).build()); } } diff --git a/fabric/src/de/chaoscaot/altauth/fabric/mixin/ConnectScreenMixin.java b/fabric/src/de/chaoscaot/altauth/fabric/mixin/ConnectScreenMixin.java index 3b94b5c..c419a1e 100644 --- a/fabric/src/de/chaoscaot/altauth/fabric/mixin/ConnectScreenMixin.java +++ b/fabric/src/de/chaoscaot/altauth/fabric/mixin/ConnectScreenMixin.java @@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.ModifyArg; @Mixin(ConnectScreen.class) public class ConnectScreenMixin { - @ModifyArg(method = "connect(Lnet/minecraft/client/gui/screen/Screen;Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/network/ServerAddress;Lnet/minecraft/client/network/ServerInfo;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ConnectScreen;connect(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/network/ServerAddress;)V"), index = 1) + @ModifyArg(method = "connect(Lnet/minecraft/client/gui/screen/Screen;Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/network/ServerAddress;Lnet/minecraft/client/network/ServerInfo;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ConnectScreen;connect(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/network/ServerAddress;Lnet/minecraft/client/network/ServerInfo;)V"), index = 1) private static ServerAddress copyServerAddress(ServerAddress address) { AltAuth.address = address; return address; diff --git a/gradle.properties b/gradle.properties index ec2a6b9..6b39c7d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ org.gradle.jvmargs=-Xmx1G -minecraft_version=1.19.2 -yarn_mappings=1.19.2+build.4 -loader_version=0.14.9 +minecraft_version=1.19.3 +yarn_mappings=1.19.3+build.2 +loader_version=0.14.11 version=1.0.0