From f912a1e1e2a46a994cfaa3ea6924a82417893e46 Mon Sep 17 00:00:00 2001 From: Josiah Glosson Date: Sun, 30 Jun 2024 21:01:10 -0500 Subject: [PATCH] Fix build --- .../worldhost/protocol/ProtocolClient.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/gaming32/worldhost/protocol/ProtocolClient.java b/src/main/java/io/github/gaming32/worldhost/protocol/ProtocolClient.java index 45e8947..ca5ff48 100644 --- a/src/main/java/io/github/gaming32/worldhost/protocol/ProtocolClient.java +++ b/src/main/java/io/github/gaming32/worldhost/protocol/ProtocolClient.java @@ -32,6 +32,10 @@ import java.util.concurrent.Future; import java.util.concurrent.LinkedBlockingQueue; +//#if MC < 1.20.4 +//$$ import com.mojang.authlib.GameProfile; +//#endif + public final class ProtocolClient implements AutoCloseable, ProxyPassthrough { private static final Thread.Builder CONNECTION_THREAD_BUILDER = Thread.ofVirtual().name("WH-ConnectionThread-", 1); private static final Thread.Builder SEND_THREAD_BUILDER = Thread.ofVirtual().name("WH-SendThread-", 1); @@ -215,13 +219,27 @@ private static void performHandshake( dos.write(encryptedSecretKey); dos.flush(); - if (user.getProfileId().version() == 4) { + //#if MC >= 1.20.4 + final UUID profileId = user.getProfileId(); + //#else + //$$ final GameProfile profile = user.getGameProfile(); + //$$ final UUID profileId = profile.getId(); + //#endif + + if (profileId.version() == 4) { Minecraft.getInstance() .getMinecraftSessionService() - .joinServer(user.getProfileId(), user.getAccessToken(), authKey); + .joinServer( + //#if MC >= 1.20.4 + profileId, + //#else + //$$ profile, + //#endif + user.getAccessToken(), authKey + ); } - WorldHostC2SMessage.writeUuid(dos, user.getProfileId()); + WorldHostC2SMessage.writeUuid(dos, profileId); WorldHostC2SMessage.writeString(dos, user.getName()); dos.writeLong(connectionId); dos.flush();