Skip to content

Commit

Permalink
Java 1.20.2 and Bedrock 1.20.40 (#20)
Browse files Browse the repository at this point in the history
* Support 23w31a changes

* 1.20.2-pre2

* MCPL 1.20.2 is now on our maven repo

* Bedrock 1.20.40

---------

Co-authored-by: basaigh <[email protected]>
  • Loading branch information
Konicai and basaigh authored Oct 26, 2023
1 parent 6498846 commit c9f9df6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 32 deletions.
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[versions]
gson = "2.10.1"
protocol = "3.0.0.Beta1-20230908.171156-106"
protocol-connection = "3.0.0.Beta1-20230908.171156-105"
protocol = "3.0.0.Beta1-20231016.115644-107"
protocol-connection = "3.0.0.Beta1-20231016.115644-106"
netty = "4.1.80.Final"
fastutil = "8.5.2"
mcprotocollib = "1.20-1-20230607.135651-6" # Temporary hack - needs to be updated to release once publishing is fixed
mcprotocollib = "1.20.2-1-20231003.141424-6"
adventure-text = "4.9.3" # Match version to MCPL
mariadb-client = "2.7.3"
checker-qual = "3.21.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.cloudburstmc.protocol.bedrock.codec.v589.Bedrock_v589;
import org.cloudburstmc.protocol.bedrock.codec.v594.Bedrock_v594;
import org.cloudburstmc.protocol.bedrock.codec.v618.Bedrock_v618;
import org.cloudburstmc.protocol.bedrock.codec.v622.Bedrock_v622;

/**
* Contains information about the supported Bedrock protocols in GlobalLinkServer.
Expand All @@ -40,7 +41,7 @@ public class BedrockVersionUtils {
* Default Bedrock codec that should act as a fallback. Should represent the latest available
* release of the game that GlobalLinkServer supports.
*/
public static final BedrockCodec LATEST_CODEC = Bedrock_v618.CODEC;
public static final BedrockCodec LATEST_CODEC = Bedrock_v622.CODEC;

/**
* A list of all supported Bedrock versions that can join GlobalLinkServer
Expand All @@ -50,6 +51,7 @@ public class BedrockVersionUtils {
static {
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v589.CODEC);
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v594.CODEC);
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v618.CODEC);
SUPPORTED_BEDROCK_CODECS.add(LATEST_CODEC);
}

Expand Down
39 changes: 11 additions & 28 deletions src/main/java/org/geysermc/globallinkserver/java/JavaServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.github.steveice10.mc.protocol.data.game.command.CommandType;
import com.github.steveice10.mc.protocol.data.game.command.properties.IntegerProperties;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerSpawnInfo;
import com.github.steveice10.mc.protocol.data.status.PlayerInfo;
import com.github.steveice10.mc.protocol.data.status.ServerStatusInfo;
import com.github.steveice10.mc.protocol.data.status.VersionInfo;
Expand All @@ -44,30 +45,21 @@
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerAbilitiesPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetHealthPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetDefaultSpawnPositionPacket;
import com.github.steveice10.opennbt.NBTIO;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.packetlib.Server;
import com.github.steveice10.packetlib.event.server.ServerAdapter;
import com.github.steveice10.packetlib.event.server.ServerClosedEvent;
import com.github.steveice10.packetlib.event.server.SessionAddedEvent;
import com.github.steveice10.packetlib.event.session.ConnectedEvent;
import com.github.steveice10.packetlib.tcp.TcpServer;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.OptionalInt;
import java.util.zip.GZIPInputStream;
import net.kyori.adventure.text.Component;
import org.cloudburstmc.math.vector.Vector3i;
import org.geysermc.globallinkserver.config.Config;
import org.geysermc.globallinkserver.link.LinkManager;
import org.geysermc.globallinkserver.player.PlayerManager;

public class JavaServer implements org.geysermc.globallinkserver.Server {
private static final CompoundTag REGISTRY_CODEC = loadRegistryCodec();

private final PlayerManager playerManager;
private final LinkManager linkManager;

Expand Down Expand Up @@ -134,22 +126,23 @@ public boolean startServer(Config config) {
session.send(new ClientboundLoginPacket(
0,
false,
GameMode.SPECTATOR,
GameMode.SPECTATOR,
new String[] {"minecraft:the_end"},
REGISTRY_CODEC,
"minecraft:the_end",
"minecraft:the_end",
100,
1,
0,
0,
false,
false,
false,
false,
null,
100));
new PlayerSpawnInfo(
"minecraft:the_end",
"minecraft:the_end",
100,
GameMode.SPECTATOR,
GameMode.SPECTATOR,
false,
false,
null,
100)));

session.send(new ClientboundPlayerAbilitiesPacket(false, false, true, false, 0f, 0f));

Expand Down Expand Up @@ -188,14 +181,4 @@ public void shutdown() {
server.close();
server = null;
}

public static CompoundTag loadRegistryCodec() {
try (InputStream inputStream = JavaServer.class.getClassLoader().getResourceAsStream("registry_codec.nbt");
DataInputStream stream = new DataInputStream(new GZIPInputStream(inputStream))) {
return (CompoundTag) NBTIO.readTag((DataInput) stream);
} catch (IOException e) {
e.printStackTrace();
throw new AssertionError("Unable to load login registry.");
}
}
}
Binary file removed src/main/resources/registry_codec.nbt
Binary file not shown.

0 comments on commit c9f9df6

Please sign in to comment.