From e994ede5f0ac6bd34e18d8320e47acefc97d425f Mon Sep 17 00:00:00 2001 From: IzzelAliz Date: Sun, 11 Dec 2022 16:57:05 +0800 Subject: [PATCH] Update to 1.19.3 --- README.md | 2 +- build.gradle | 6 +++--- .../io/izzel/lightfall/client/LightfallClient.java | 8 ++++++-- .../client/gui/LightfallHandshakeScreen.java | 5 ++--- .../client/mixin/ClientPacketListenerAccessor.java | 13 +++++++++++++ src/main/resources/mixins.lightfall.json | 3 ++- 6 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 src/main/java/io/izzel/lightfall/client/mixin/ClientPacketListenerAccessor.java diff --git a/README.md b/README.md index 101fa17..b446bbd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ## lightfall-client -Support Minecraft 1.15.X - 1.16.X +Support Minecraft 1.16.X - 1.19.X Use this with https://github.com/ArclightPowered/lightfall \ No newline at end of file diff --git a/build.gradle b/build.gradle index f8e89aa..1163f36 100644 --- a/build.gradle +++ b/build.gradle @@ -14,13 +14,13 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' group = 'io.izzel.lightfall' -version = '1.1.0' +version = '1.1.1' archivesBaseName = 'lightfallclient' java.toolchain.languageVersion = JavaLanguageVersion.of(17) minecraft { - mappings channel: 'official', version: "1.19.2" + mappings channel: 'official', version: "1.19.3" runs { client { workingDirectory project.file('run') @@ -45,7 +45,7 @@ repositories { } dependencies { - minecraft 'net.minecraftforge:forge:1.19.2-43.1.1' + minecraft 'net.minecraftforge:forge:1.19.3-44.0.5' annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' } diff --git a/src/main/java/io/izzel/lightfall/client/LightfallClient.java b/src/main/java/io/izzel/lightfall/client/LightfallClient.java index fafe3c8..b8bbfab 100644 --- a/src/main/java/io/izzel/lightfall/client/LightfallClient.java +++ b/src/main/java/io/izzel/lightfall/client/LightfallClient.java @@ -2,6 +2,7 @@ import io.izzel.lightfall.client.bridge.ClientLoginNetHandlerBridge; import io.izzel.lightfall.client.gui.LightfallHandshakeScreen; +import io.izzel.lightfall.client.mixin.ClientPacketListenerAccessor; import io.netty.buffer.Unpooled; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.TitleScreen; @@ -63,8 +64,11 @@ private static void handleReset(NetworkEvent.ServerCustomPayloadEvent event) { netManager.setProtocol(ConnectionProtocol.LOGIN); var buffer = new FriendlyByteBuf(Unpooled.wrappedBuffer(RESET_ACK)); netManager.send(new ServerboundCustomQueryPacket(0x11FFA1, buffer)); - var netHandler = new ClientHandshakePacketListenerImpl(netManager, client, new JoinMultiplayerScreen(new TitleScreen()), screen::setComponent); - ((ClientLoginNetHandlerBridge) netHandler).bridge$reusePlayHandler((ClientPacketListener) netManager.getPacketListener()); + var packetListener = (ClientPacketListener) netManager.getPacketListener(); + var netHandler = new ClientHandshakePacketListenerImpl(netManager, client, + ((ClientPacketListenerAccessor) packetListener).accessor$getServerData(), + new JoinMultiplayerScreen(new TitleScreen()), false, null, screen::setComponent); + ((ClientLoginNetHandlerBridge) netHandler).bridge$reusePlayHandler(packetListener); netManager.setListener(netHandler); }).join(); context.setPacketHandled(true); diff --git a/src/main/java/io/izzel/lightfall/client/gui/LightfallHandshakeScreen.java b/src/main/java/io/izzel/lightfall/client/gui/LightfallHandshakeScreen.java index c026201..bc06c51 100644 --- a/src/main/java/io/izzel/lightfall/client/gui/LightfallHandshakeScreen.java +++ b/src/main/java/io/izzel/lightfall/client/gui/LightfallHandshakeScreen.java @@ -37,14 +37,13 @@ public void tick() { @Override protected void init() { this.addRenderableWidget( - new Button(this.width / 2 - 100, this.height / 4 + 120 + 12, 200, 20, CommonComponents.GUI_CANCEL, + Button.builder(CommonComponents.GUI_CANCEL, button -> { if (this.networkManager.isConnected()) { this.networkManager.disconnect(Component.translatable("connect.aborted")); } this.minecraft.setScreen(new JoinMultiplayerScreen(new TitleScreen())); - } - ) + }).bounds(this.width / 2 - 100, this.height / 4 + 120 + 12, 200, 20).build() ); } diff --git a/src/main/java/io/izzel/lightfall/client/mixin/ClientPacketListenerAccessor.java b/src/main/java/io/izzel/lightfall/client/mixin/ClientPacketListenerAccessor.java new file mode 100644 index 0000000..f85f2d8 --- /dev/null +++ b/src/main/java/io/izzel/lightfall/client/mixin/ClientPacketListenerAccessor.java @@ -0,0 +1,13 @@ +package io.izzel.lightfall.client.mixin; + +import net.minecraft.client.multiplayer.ClientPacketListener; +import net.minecraft.client.multiplayer.ServerData; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(ClientPacketListener.class) +public interface ClientPacketListenerAccessor { + + @Accessor("serverData") + ServerData accessor$getServerData(); +} diff --git a/src/main/resources/mixins.lightfall.json b/src/main/resources/mixins.lightfall.json index db49d0a..a93cd64 100644 --- a/src/main/resources/mixins.lightfall.json +++ b/src/main/resources/mixins.lightfall.json @@ -8,6 +8,7 @@ "defaultRequire": 1 }, "client": [ - "ClientLoginNetHandlerMixin" + "ClientLoginNetHandlerMixin", + "ClientPacketListenerAccessor" ] } \ No newline at end of file