From 9bc0af52d52ea1124ebd643103ec8df58b425056 Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Tue, 27 Feb 2024 23:47:30 +0100 Subject: [PATCH] Fixed 1.7.2 -> 1.6.4 translation --- .../Protocol1_7_2_5to1_6_4.java | 13 ++++++++++++- .../Protocol1_8to1_7_6_10.java | 8 ++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_7_2_5to1_6_4/Protocol1_7_2_5to1_6_4.java b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_7_2_5to1_6_4/Protocol1_7_2_5to1_6_4.java index f38ea6d..0a8af73 100644 --- a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_7_2_5to1_6_4/Protocol1_7_2_5to1_6_4.java +++ b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_7_2_5to1_6_4/Protocol1_7_2_5to1_6_4.java @@ -867,10 +867,21 @@ public class Protocol1_7_2_5to1_6_4 extends StatelessTransitionProtocol { final HandshakeStorage handshakeStorage = wrapper.user().get(HandshakeStorage.class); + final String name = wrapper.read(Type.STRING); // user name + wrapper.write(Type.UNSIGNED_BYTE, (short) wrapper.user().getProtocolInfo().serverProtocolVersion().getVersion()); // protocol id - wrapper.write(Types1_6_4.STRING, wrapper.read(Type.STRING)); // user name + wrapper.write(Types1_6_4.STRING, name); // user name wrapper.write(Types1_6_4.STRING, handshakeStorage.getHostname()); // hostname wrapper.write(Type.INT, handshakeStorage.getPort()); // port + + final ProtocolInfo info = wrapper.user().getProtocolInfo(); + // Set the information early + if (info.getUsername() == null) { + info.setUsername(name); + } + if (info.getUuid() == null) { + info.setUuid(ViaLegacy.getConfig().isLegacySkinLoading() ? Via.getManager().getProviders().get(GameProfileFetcher.class).getMojangUUID(name) : new GameProfile(name).uuid); + } }); this.registerServerboundTransition(ServerboundLoginPackets.ENCRYPTION_KEY, ServerboundPackets1_6_4.SHARED_KEY, null); this.registerServerbound(ServerboundPackets1_7_2.CHAT_MESSAGE, new PacketHandlers() { diff --git a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_8to1_7_6_10/Protocol1_8to1_7_6_10.java b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_8to1_7_6_10/Protocol1_8to1_7_6_10.java index ed7c32f..b52932d 100644 --- a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_8to1_7_6_10/Protocol1_8to1_7_6_10.java +++ b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_8to1_7_6_10/Protocol1_8to1_7_6_10.java @@ -1170,8 +1170,12 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol