Skip to content

Commit

Permalink
Added support for 1.21 and fixed loading terrain
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim203 committed Jun 21, 2024
1 parent b147e24 commit a77afd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/org/geysermc/globallinkserver/java/JavaServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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

Expand Down

0 comments on commit a77afd1

Please sign in to comment.