From a77afd195ca7fd58c37d557663148683e41e1dba Mon Sep 17 00:00:00 2001 From: Tim203 Date: Fri, 21 Jun 2024 19:27:42 +0200 Subject: [PATCH] Added support for 1.21 and fixed loading terrain --- gradle/libs.versions.toml | 2 +- .../geysermc/globallinkserver/java/JavaServer.java | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 41495c5..057d8d1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,7 +4,7 @@ protocol = "3.0.0.Beta2-20240423.201358-2" raknet = "1.0.0.CR1-20240330.103819-16" netty = "4.1.80.Final" fastutil = "8.5.2" -mcprotocollib = "12b94d74" # Revert from jitpack after release +mcprotocollib = "4f5f650" # Revert from jitpack after release adventure-text = "4.15.0-20231207.074016-23" # Match version to MCPL mariadb-client = "2.7.3" checker-qual = "3.21.1" diff --git a/src/main/java/org/geysermc/globallinkserver/java/JavaServer.java b/src/main/java/org/geysermc/globallinkserver/java/JavaServer.java index 2932ec4..8c1efdb 100644 --- a/src/main/java/org/geysermc/globallinkserver/java/JavaServer.java +++ b/src/main/java/org/geysermc/globallinkserver/java/JavaServer.java @@ -29,6 +29,7 @@ import com.github.steveice10.mc.auth.service.SessionService; import java.util.Collections; import java.util.OptionalInt; +import net.kyori.adventure.key.Key; import net.kyori.adventure.text.Component; import org.cloudburstmc.math.vector.Vector3i; import org.geysermc.globallinkserver.config.Config; @@ -129,7 +130,7 @@ public boolean startServer(Config config) { session.send(new ClientboundLoginPacket( 0, false, - new String[] {"minecraft:the_end"}, + new Key[] {Key.key("minecraft:the_end")}, 1, 0, 0, @@ -138,7 +139,7 @@ public boolean startServer(Config config) { false, new PlayerSpawnInfo( 2, - "minecraft:the_end", + Key.key("minecraft:the_end"), 100, GameMode.SPECTATOR, GameMode.SPECTATOR, @@ -158,15 +159,15 @@ public boolean startServer(Config config) { // this packet is also required to let our player spawn, but the location itself doesn't matter session.send(new ClientboundSetDefaultSpawnPositionPacket(Vector3i.ZERO, 0)); - // Manually call the connect event - session.callEvent(new ConnectedEvent(session)); - // we have to listen to the teleport confirm on the PacketHandler to prevent respawn request packet spam, // so send it after calling ConnectedEvent which adds the PacketHandler as listener session.send(new ClientboundPlayerPositionPacket(0, 0, 0, 0, 0, 0)); // this packet is required since 1.20.3 session.send(new ClientboundGameEventPacket(GameEvent.LEVEL_CHUNKS_LOAD_START, null)); + + // Manually call the connect event + session.callEvent(new ConnectedEvent(session)); }); server.setGlobalFlag(MinecraftConstants.SERVER_COMPRESSION_THRESHOLD, 256); // default