diff --git a/example/src/main/java/com/github/steveice10/mc/protocol/test/MinecraftProtocolTest.java b/example/src/main/java/com/github/steveice10/mc/protocol/test/MinecraftProtocolTest.java
index 29bc4ed82..a28c03b4d 100644
--- a/example/src/main/java/com/github/steveice10/mc/protocol/test/MinecraftProtocolTest.java
+++ b/example/src/main/java/com/github/steveice10/mc/protocol/test/MinecraftProtocolTest.java
@@ -11,6 +11,7 @@
import com.github.steveice10.mc.protocol.codec.MinecraftCodec;
import com.github.steveice10.mc.protocol.data.ProtocolState;
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;
@@ -46,6 +47,7 @@
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.BitSet;
import java.util.zip.GZIPInputStream;
public class MinecraftProtocolTest {
@@ -69,7 +71,7 @@ public static void main(String[] args) {
server.setGlobalFlag(MinecraftConstants.SERVER_INFO_BUILDER_KEY, (ServerInfoBuilder) session ->
new ServerStatusInfo(
new VersionInfo(MinecraftCodec.CODEC.getMinecraftVersion(), MinecraftCodec.CODEC.getProtocolVersion()),
- new PlayerInfo(100, 0, new GameProfile[0]),
+ new PlayerInfo(100, 0, new ArrayList<>()),
Component.text("Hello world!"),
null,
false
@@ -80,22 +82,24 @@ public static void main(String[] args) {
session.send(new ClientboundLoginPacket(
0,
false,
- GameMode.SURVIVAL,
- GameMode.SURVIVAL,
- 1,
new String[]{"minecraft:world"},
- loadNetworkCodec(),
- "minecraft:overworld",
- "minecraft:world",
- 100,
0,
16,
16,
false,
false,
false,
- false,
- null
+ new PlayerSpawnInfo(
+ "minecraft:overworld",
+ "minecraft:world",
+ 100,
+ GameMode.SURVIVAL,
+ GameMode.SURVIVAL,
+ false,
+ false,
+ null,
+ 100
+ )
))
);
@@ -158,7 +162,7 @@ private static void status() {
+ ", " + info.getVersionInfo().getProtocolVersion());
System.out.println("Player Count: " + info.getPlayerInfo().getOnlinePlayers()
+ " / " + info.getPlayerInfo().getMaxPlayers());
- System.out.println("Players: " + Arrays.toString(info.getPlayerInfo().getPlayers()));
+ System.out.println("Players: " + Arrays.toString(info.getPlayerInfo().getPlayers().toArray()));
System.out.println("Description: " + info.getDescription());
System.out.println("Icon: " + info.getIconPng());
});
@@ -205,7 +209,7 @@ private static void login() {
@Override
public void packetReceived(Session session, Packet packet) {
if (packet instanceof ClientboundLoginPacket) {
- session.send(new ServerboundChatPacket("Hello, this is a test of MCProtocolLib.", Instant.now().toEpochMilli(), 0, new byte[0], false, new ArrayList<>(), null));
+ session.send(new ServerboundChatPacket("Hello, this is a test of MCProtocolLib.", Instant.now().toEpochMilli(), 0L, null, 0, new BitSet()));
} else if (packet instanceof ClientboundSystemChatPacket) {
Component message = ((ClientboundSystemChatPacket) packet).getContent();
System.out.println("Received Message: " + message);
@@ -224,14 +228,4 @@ public void disconnected(DisconnectedEvent event) {
client.connect();
}
-
- private static CompoundTag loadNetworkCodec() {
- try (InputStream inputStream = MinecraftProtocolTest.class.getClassLoader().getResourceAsStream("network_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 network codec.");
- }
- }
}
diff --git a/example/src/main/resources/network_codec.nbt b/example/src/main/resources/network_codec.nbt
deleted file mode 100644
index 626392993..000000000
Binary files a/example/src/main/resources/network_codec.nbt and /dev/null differ
diff --git a/pom.xml b/pom.xml
index efb4f83a8..3909661e9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.github.steveice10
mcprotocollib
- 1.20-2
+ 1.20.2-1-SNAPSHOT
jar
MCProtocolLib
@@ -82,9 +82,9 @@
- com.github.GeyserMC
+ com.github.steveice10
opennbt
- 1.4
+ 1.6
compile
diff --git a/src/main/java/com/github/steveice10/mc/protocol/ClientListener.java b/src/main/java/com/github/steveice10/mc/protocol/ClientListener.java
index 48b85d8f1..22d669128 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/ClientListener.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/ClientListener.java
@@ -11,16 +11,21 @@
import com.github.steveice10.mc.protocol.data.status.ServerStatusInfo;
import com.github.steveice10.mc.protocol.data.status.handler.ServerInfoHandler;
import com.github.steveice10.mc.protocol.data.status.handler.ServerPingTimeHandler;
+import com.github.steveice10.mc.protocol.packet.configuration.clientbound.ClientboundFinishConfigurationPacket;
+import com.github.steveice10.mc.protocol.packet.configuration.serverbound.ServerboundFinishConfigurationPacket;
import com.github.steveice10.mc.protocol.packet.handshake.serverbound.ClientIntentionPacket;
-import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDisconnectPacket;
-import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundKeepAlivePacket;
-import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundKeepAlivePacket;
+import com.github.steveice10.mc.protocol.packet.common.clientbound.ClientboundDisconnectPacket;
+import com.github.steveice10.mc.protocol.packet.common.clientbound.ClientboundKeepAlivePacket;
+import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundKeepAlivePacket;
+import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundStartConfigurationPacket;
+import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundConfigurationAcknowledgedPacket;
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundGameProfilePacket;
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundHelloPacket;
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundLoginCompressionPacket;
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundLoginDisconnectPacket;
import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundHelloPacket;
import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundKeyPacket;
+import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundLoginAcknowledgedPacket;
import com.github.steveice10.mc.protocol.packet.status.clientbound.ClientboundPongResponsePacket;
import com.github.steveice10.mc.protocol.packet.status.clientbound.ClientboundStatusResponsePacket;
import com.github.steveice10.mc.protocol.packet.status.serverbound.ServerboundPingRequestPacket;
@@ -31,11 +36,11 @@
import com.github.steveice10.packetlib.packet.Packet;
import lombok.AllArgsConstructor;
import lombok.NonNull;
+import lombok.SneakyThrows;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import java.security.NoSuchAlgorithmException;
-import java.util.UUID;
/**
* Handles making initial login and status requests for clients.
@@ -44,6 +49,7 @@
public class ClientListener extends SessionAdapter {
private final @NonNull ProtocolState targetState;
+ @SneakyThrows
@Override
public void packetReceived(Session session, Packet packet) {
MinecraftProtocol protocol = (MinecraftProtocol) session.getPacketProtocol();
@@ -84,7 +90,7 @@ public void packetReceived(Session session, Packet packet) {
session.send(new ServerboundKeyPacket(helloPacket.getPublicKey(), key, helloPacket.getChallenge()));
session.enableEncryption(protocol.enableEncryption(key));
} else if (packet instanceof ClientboundGameProfilePacket) {
- protocol.setState(ProtocolState.GAME);
+ session.send(new ServerboundLoginAcknowledgedPacket());
} else if (packet instanceof ClientboundLoginDisconnectPacket) {
session.disconnect(((ClientboundLoginDisconnectPacket) packet).getReason());
} else if (packet instanceof ClientboundLoginCompressionPacket) {
@@ -113,15 +119,21 @@ public void packetReceived(Session session, Packet packet) {
session.send(new ServerboundKeepAlivePacket(((ClientboundKeepAlivePacket) packet).getPingId()));
} else if (packet instanceof ClientboundDisconnectPacket) {
session.disconnect(((ClientboundDisconnectPacket) packet).getReason());
+ } else if (packet instanceof ClientboundStartConfigurationPacket) {
+ session.send(new ServerboundConfigurationAcknowledgedPacket());
+ }
+ } else if (protocol.getState() == ProtocolState.CONFIGURATION) {
+ if (packet instanceof ClientboundFinishConfigurationPacket) {
+ session.send(new ServerboundFinishConfigurationPacket());
}
}
}
@Override
public void packetSent(Session session, Packet packet) {
+ MinecraftProtocol protocol = (MinecraftProtocol) session.getPacketProtocol();
if (packet instanceof ClientIntentionPacket) {
// Once the HandshakePacket has been sent, switch to the next protocol mode.
- MinecraftProtocol protocol = (MinecraftProtocol) session.getPacketProtocol();
protocol.setState(this.targetState);
if (this.targetState == ProtocolState.LOGIN) {
@@ -130,6 +142,12 @@ public void packetSent(Session session, Packet packet) {
} else {
session.send(new ServerboundStatusRequestPacket());
}
+ } else if (packet instanceof ServerboundLoginAcknowledgedPacket) {
+ protocol.setState(ProtocolState.CONFIGURATION); // LOGIN -> CONFIGURATION
+ } else if (packet instanceof ServerboundFinishConfigurationPacket) {
+ protocol.setState(ProtocolState.GAME); // CONFIGURATION -> GAME
+ } else if (packet instanceof ServerboundConfigurationAcknowledgedPacket) {
+ protocol.setState(ProtocolState.CONFIGURATION); // GAME -> CONFIGURATION
}
}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/MinecraftProtocol.java b/src/main/java/com/github/steveice10/mc/protocol/MinecraftProtocol.java
index c16f257de..1f076c99d 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/MinecraftProtocol.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/MinecraftProtocol.java
@@ -6,6 +6,8 @@
import com.github.steveice10.mc.protocol.codec.PacketCodec;
import com.github.steveice10.mc.protocol.codec.PacketStateCodec;
import com.github.steveice10.mc.protocol.data.ProtocolState;
+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.Session;
import com.github.steveice10.packetlib.codec.PacketCodecHelper;
@@ -19,17 +21,31 @@
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
+import org.jetbrains.annotations.Nullable;
+import java.io.DataInput;
+import java.io.DataInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.security.GeneralSecurityException;
import java.security.Key;
+import java.util.Objects;
import java.util.UUID;
+import java.util.zip.GZIPInputStream;
/**
* Implements the Minecraft protocol.
*/
public class MinecraftProtocol extends PacketProtocol {
+ /**
+ * The network codec sent from the server to the client during {@link ProtocolState#CONFIGURATION}.
+ * Lazily loaded once when {@link #newServerSession(Server, Session)} is invoked,
+ * if {@link #isUseDefaultListeners()} is true.
+ */
+ @Nullable
+ private static CompoundTag DEFAULT_NETWORK_CODEC;
+
/**
* The codec used for the Minecraft protocol.
*/
@@ -85,7 +101,7 @@ public MinecraftProtocol(PacketCodec codec) {
* @param username Username to use.
*/
public MinecraftProtocol(@NonNull String username) {
- this(new GameProfile((UUID) null, username), null);
+ this(new GameProfile(UUID.randomUUID(), username), null);
}
/**
@@ -95,7 +111,7 @@ public MinecraftProtocol(@NonNull String username) {
* @param username Username to use.
*/
public MinecraftProtocol(@NonNull PacketCodec codec, @NonNull String username) {
- this(codec, new GameProfile((UUID) null, username), null);
+ this(codec, new GameProfile(UUID.randomUUID(), username), null);
}
/**
@@ -156,7 +172,11 @@ public void newServerSession(Server server, Session session) {
this.setState(ProtocolState.HANDSHAKE);
if (this.useDefaultListeners) {
- session.addListener(new ServerListener());
+ if (DEFAULT_NETWORK_CODEC == null) {
+ DEFAULT_NETWORK_CODEC = loadNetworkCodec();
+ }
+
+ session.addListener(new ServerListener(DEFAULT_NETWORK_CODEC));
}
}
@@ -231,4 +251,13 @@ public Class extends Packet> getServerboundClass(int id) {
public PacketDefinition, ?> getClientboundDefinition(int id) {
return this.stateCodec.getClientboundDefinition(id);
}
+
+ public static CompoundTag loadNetworkCodec() {
+ try (InputStream inputStream = Objects.requireNonNull(MinecraftProtocol.class.getClassLoader().getResourceAsStream("networkCodec.nbt")) ;
+ DataInputStream stream = new DataInputStream(new GZIPInputStream(inputStream))) {
+ return (CompoundTag) NBTIO.readTag((DataInput) stream);
+ } catch (Exception e) {
+ throw new AssertionError("Unable to load network codec.", e);
+ }
+ }
}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/ServerListener.java b/src/main/java/com/github/steveice10/mc/protocol/ServerListener.java
index 9adaab0b6..9144830d7 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/ServerListener.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/ServerListener.java
@@ -8,20 +8,26 @@
import com.github.steveice10.mc.protocol.data.status.ServerStatusInfo;
import com.github.steveice10.mc.protocol.data.status.VersionInfo;
import com.github.steveice10.mc.protocol.data.status.handler.ServerInfoBuilder;
+import com.github.steveice10.mc.protocol.packet.configuration.clientbound.ClientboundFinishConfigurationPacket;
+import com.github.steveice10.mc.protocol.packet.configuration.clientbound.ClientboundRegistryDataPacket;
+import com.github.steveice10.mc.protocol.packet.configuration.serverbound.ServerboundFinishConfigurationPacket;
import com.github.steveice10.mc.protocol.packet.handshake.serverbound.ClientIntentionPacket;
-import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDisconnectPacket;
-import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundKeepAlivePacket;
-import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundKeepAlivePacket;
+import com.github.steveice10.mc.protocol.packet.common.clientbound.ClientboundDisconnectPacket;
+import com.github.steveice10.mc.protocol.packet.common.clientbound.ClientboundKeepAlivePacket;
+import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundKeepAlivePacket;
+import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundConfigurationAcknowledgedPacket;
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundGameProfilePacket;
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundHelloPacket;
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundLoginCompressionPacket;
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundLoginDisconnectPacket;
import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundHelloPacket;
import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundKeyPacket;
+import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundLoginAcknowledgedPacket;
import com.github.steveice10.mc.protocol.packet.status.clientbound.ClientboundPongResponsePacket;
import com.github.steveice10.mc.protocol.packet.status.clientbound.ClientboundStatusResponsePacket;
import com.github.steveice10.mc.protocol.packet.status.serverbound.ServerboundPingRequestPacket;
import com.github.steveice10.mc.protocol.packet.status.serverbound.ServerboundStatusRequestPacket;
+import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.packetlib.Session;
import com.github.steveice10.packetlib.event.session.ConnectedEvent;
import com.github.steveice10.packetlib.event.session.DisconnectingEvent;
@@ -59,13 +65,16 @@ public class ServerListener extends SessionAdapter {
}
}
+ private final CompoundTag networkCodec;
+
private final byte[] challenge = new byte[4];
private String username = "";
private long lastPingTime = 0;
private int lastPingId = 0;
- public ServerListener() {
+ public ServerListener(CompoundTag networkCodec) {
+ this.networkCodec = networkCodec;
new Random().nextBytes(this.challenge);
}
@@ -97,9 +106,7 @@ public void packetReceived(Session session, Packet packet) {
throw new UnsupportedOperationException("Invalid client intent: " + intentionPacket.getIntent());
}
}
- }
-
- if (protocol.getState() == ProtocolState.LOGIN) {
+ } else if (protocol.getState() == ProtocolState.LOGIN) {
if (packet instanceof ServerboundHelloPacket) {
this.username = ((ServerboundHelloPacket) packet).getUsername();
@@ -120,10 +127,12 @@ public void packetReceived(Session session, Packet packet) {
SecretKey key = keyPacket.getSecretKey(privateKey);
session.enableEncryption(protocol.enableEncryption(key));
new Thread(new UserAuthTask(session, key)).start();
+ } else if (packet instanceof ServerboundLoginAcknowledgedPacket) {
+ ((MinecraftProtocol) session.getPacketProtocol()).setState(ProtocolState.CONFIGURATION);
+ session.send(new ClientboundRegistryDataPacket(networkCodec));
+ session.send(new ClientboundFinishConfigurationPacket());
}
- }
-
- if (protocol.getState() == ProtocolState.STATUS) {
+ } else if (protocol.getState() == ProtocolState.STATUS) {
if (packet instanceof ServerboundStatusRequestPacket) {
ServerInfoBuilder builder = session.getFlag(MinecraftConstants.SERVER_INFO_BUILDER_KEY);
if (builder == null) {
@@ -141,14 +150,28 @@ public void packetReceived(Session session, Packet packet) {
} else if (packet instanceof ServerboundPingRequestPacket) {
session.send(new ClientboundPongResponsePacket(((ServerboundPingRequestPacket) packet).getPingTime()));
}
- }
-
- if (protocol.getState() == ProtocolState.GAME) {
+ } else if (protocol.getState() == ProtocolState.GAME) {
if (packet instanceof ServerboundKeepAlivePacket) {
if (((ServerboundKeepAlivePacket) packet).getPingId() == this.lastPingId) {
long time = System.currentTimeMillis() - this.lastPingTime;
session.setFlag(MinecraftConstants.PING_KEY, time);
}
+ } else if (packet instanceof ServerboundConfigurationAcknowledgedPacket) {
+ protocol.setState(ProtocolState.CONFIGURATION);
+ } else if (packet instanceof ServerboundPingRequestPacket) {
+ session.send(new ClientboundPongResponsePacket(((ServerboundPingRequestPacket) packet).getPingTime()));
+ }
+ } else if (protocol.getState() == ProtocolState.CONFIGURATION) {
+ if (packet instanceof ServerboundFinishConfigurationPacket) {
+ protocol.setState(ProtocolState.GAME);
+ ServerLoginHandler handler = session.getFlag(MinecraftConstants.SERVER_LOGIN_HANDLER_KEY);
+ if (handler != null) {
+ handler.loggedIn(session);
+ }
+
+ if (session.getFlag(MinecraftConstants.AUTOMATIC_KEEP_ALIVE_MANAGEMENT, true)) {
+ new Thread(new KeepAliveTask(session)).start();
+ }
}
}
}
@@ -158,16 +181,6 @@ public void packetSent(Session session, Packet packet) {
if (packet instanceof ClientboundLoginCompressionPacket) {
session.setCompressionThreshold(((ClientboundLoginCompressionPacket) packet).getThreshold(), true);
session.send(new ClientboundGameProfilePacket((GameProfile) session.getFlag(MinecraftConstants.PROFILE_KEY)));
- } else if (packet instanceof ClientboundGameProfilePacket) {
- ((MinecraftProtocol) session.getPacketProtocol()).setState(ProtocolState.GAME);
- ServerLoginHandler handler = session.getFlag(MinecraftConstants.SERVER_LOGIN_HANDLER_KEY);
- if (handler != null) {
- handler.loggedIn(session);
- }
-
- if (session.getFlag(MinecraftConstants.AUTOMATIC_KEEP_ALIVE_MANAGEMENT, true)) {
- new Thread(new KeepAliveTask(session)).start();
- }
}
}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/codec/MinecraftCodec.java b/src/main/java/com/github/steveice10/mc/protocol/codec/MinecraftCodec.java
index 4628b85df..3397c0e8c 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/codec/MinecraftCodec.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/codec/MinecraftCodec.java
@@ -3,6 +3,10 @@
import com.github.steveice10.mc.protocol.data.ProtocolState;
import com.github.steveice10.mc.protocol.data.game.level.event.LevelEventType;
import com.github.steveice10.mc.protocol.data.game.level.sound.BuiltinSound;
+import com.github.steveice10.mc.protocol.packet.common.clientbound.ClientboundCustomPayloadPacket;
+import com.github.steveice10.mc.protocol.packet.configuration.clientbound.ClientboundFinishConfigurationPacket;
+import com.github.steveice10.mc.protocol.packet.configuration.clientbound.ClientboundRegistryDataPacket;
+import com.github.steveice10.mc.protocol.packet.configuration.serverbound.ServerboundFinishConfigurationPacket;
import com.github.steveice10.mc.protocol.packet.handshake.serverbound.ClientIntentionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundAwardStatsPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundBossEventPacket;
@@ -11,31 +15,31 @@
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCommandsPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCooldownPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCustomChatCompletionsPacket;
-import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCustomPayloadPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDeleteChatPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDelimiterPacket;
-import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDisconnectPacket;
+import com.github.steveice10.mc.protocol.packet.common.clientbound.ClientboundDisconnectPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDisguisedChatPacket;
-import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundKeepAlivePacket;
+import com.github.steveice10.mc.protocol.packet.common.clientbound.ClientboundKeepAlivePacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
-import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPingPacket;
+import com.github.steveice10.mc.protocol.packet.common.clientbound.ClientboundPingPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerChatPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerInfoRemovePacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerInfoUpdatePacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRecipePacket;
-import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundResourcePackPacket;
+import com.github.steveice10.mc.protocol.packet.common.clientbound.ClientboundResourcePackPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRespawnPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSelectAdvancementsTabPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundServerDataPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSetCameraPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSoundEntityPacket;
+import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundStartConfigurationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundStopSoundPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSystemChatPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundTabListPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateAdvancementsPacket;
-import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateEnabledFeaturesPacket;
+import com.github.steveice10.mc.protocol.packet.configuration.clientbound.ClientboundUpdateEnabledFeaturesPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateRecipesPacket;
-import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateTagsPacket;
+import com.github.steveice10.mc.protocol.packet.common.clientbound.ClientboundUpdateTagsPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundAnimatePacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundDamageEventPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundEntityEventPacket;
@@ -68,7 +72,6 @@
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetHealthPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddEntityPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddExperienceOrbPacket;
-import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddPlayerPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerClosePacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetContentPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetDataPacket;
@@ -82,6 +85,8 @@
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockEntityDataPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockEventPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockUpdatePacket;
+import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundChunkBatchFinishedPacket;
+import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundChunkBatchStartPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundChunksBiomesPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundExplodePacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundForgetLevelChunkPacket;
@@ -121,13 +126,14 @@
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatSessionUpdatePacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket;
-import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientInformationPacket;
+import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundClientInformationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCommandSuggestionPacket;
-import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket;
-import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundKeepAlivePacket;
+import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundCustomPayloadPacket;
+import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundKeepAlivePacket;
+import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundConfigurationAcknowledgedPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundLockDifficultyPacket;
-import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundPongPacket;
-import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundResourcePackPacket;
+import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundPongPacket;
+import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundResourcePackPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClickPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket;
@@ -147,6 +153,7 @@
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetStructureBlockPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundBlockEntityTagQuery;
+import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundChunkBatchReceivedPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundEntityTagQuery;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundJigsawGeneratePacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundMoveVehiclePacket;
@@ -171,9 +178,10 @@
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundHelloPacket;
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundLoginCompressionPacket;
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundLoginDisconnectPacket;
-import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundCustomQueryPacket;
+import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundCustomQueryAnswerPacket;
import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundHelloPacket;
import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundKeyPacket;
+import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundLoginAcknowledgedPacket;
import com.github.steveice10.mc.protocol.packet.status.clientbound.ClientboundPongResponsePacket;
import com.github.steveice10.mc.protocol.packet.status.clientbound.ClientboundStatusResponsePacket;
import com.github.steveice10.mc.protocol.packet.status.serverbound.ServerboundPingRequestPacket;
@@ -199,189 +207,211 @@ public class MinecraftCodec {
}
public static final PacketCodec CODEC = PacketCodec.builder()
- .protocolVersion(763)
+ .protocolVersion(764)
.helper(() -> new MinecraftCodecHelper(LEVEL_EVENTS, SOUND_NAMES))
- .minecraftVersion("1.20")
+ .minecraftVersion("1.20.2")
.state(ProtocolState.HANDSHAKE, PacketStateCodec.builder()
- .registerServerboundPacket(0x00, ClientIntentionPacket.class, ClientIntentionPacket::new)
+ .registerServerboundPacket(ClientIntentionPacket.class, ClientIntentionPacket::new)
)
.state(ProtocolState.LOGIN, PacketStateCodec.builder()
- .registerClientboundPacket(0x00, ClientboundLoginDisconnectPacket.class, ClientboundLoginDisconnectPacket::new)
- .registerClientboundPacket(0x01, ClientboundHelloPacket.class, ClientboundHelloPacket::new)
- .registerClientboundPacket(0x02, ClientboundGameProfilePacket.class, ClientboundGameProfilePacket::new)
- .registerClientboundPacket(0x03, ClientboundLoginCompressionPacket.class, ClientboundLoginCompressionPacket::new)
- .registerClientboundPacket(0x04, ClientboundCustomQueryPacket.class, ClientboundCustomQueryPacket::new)
- .registerServerboundPacket(0x00, ServerboundHelloPacket.class, ServerboundHelloPacket::new)
- .registerServerboundPacket(0x01, ServerboundKeyPacket.class, ServerboundKeyPacket::new)
- .registerServerboundPacket(0x02, ServerboundCustomQueryPacket.class, ServerboundCustomQueryPacket::new)
+ .registerClientboundPacket(ClientboundLoginDisconnectPacket.class, ClientboundLoginDisconnectPacket::new)
+ .registerClientboundPacket(ClientboundHelloPacket.class, ClientboundHelloPacket::new)
+ .registerClientboundPacket(ClientboundGameProfilePacket.class, ClientboundGameProfilePacket::new)
+ .registerClientboundPacket(ClientboundLoginCompressionPacket.class, ClientboundLoginCompressionPacket::new)
+ .registerClientboundPacket(ClientboundCustomQueryPacket.class, ClientboundCustomQueryPacket::new)
+ .registerServerboundPacket(ServerboundHelloPacket.class, ServerboundHelloPacket::new)
+ .registerServerboundPacket(ServerboundKeyPacket.class, ServerboundKeyPacket::new)
+ .registerServerboundPacket(ServerboundCustomQueryAnswerPacket.class, ServerboundCustomQueryAnswerPacket::new)
+ .registerServerboundPacket(ServerboundLoginAcknowledgedPacket.class, ServerboundLoginAcknowledgedPacket::new)
).state(ProtocolState.STATUS, PacketStateCodec.builder()
- .registerClientboundPacket(0x00, ClientboundStatusResponsePacket.class, ClientboundStatusResponsePacket::new)
- .registerClientboundPacket(0x01, ClientboundPongResponsePacket.class, ClientboundPongResponsePacket::new)
- .registerServerboundPacket(0x00, ServerboundStatusRequestPacket.class, ServerboundStatusRequestPacket::new)
- .registerServerboundPacket(0x01, ServerboundPingRequestPacket.class, ServerboundPingRequestPacket::new)
+ .registerClientboundPacket(ClientboundStatusResponsePacket.class, ClientboundStatusResponsePacket::new)
+ .registerClientboundPacket(ClientboundPongResponsePacket.class, ClientboundPongResponsePacket::new)
+ .registerServerboundPacket(ServerboundStatusRequestPacket.class, ServerboundStatusRequestPacket::new)
+ .registerServerboundPacket(ServerboundPingRequestPacket.class, ServerboundPingRequestPacket::new)
+ ).state(ProtocolState.CONFIGURATION, PacketStateCodec.builder()
+ .registerClientboundPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new)
+ .registerClientboundPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new)
+ .registerClientboundPacket(ClientboundFinishConfigurationPacket.class, ClientboundFinishConfigurationPacket::new)
+ .registerClientboundPacket(ClientboundKeepAlivePacket.class, ClientboundKeepAlivePacket::new)
+ .registerClientboundPacket(ClientboundPingPacket.class, ClientboundPingPacket::new)
+ .registerClientboundPacket(ClientboundRegistryDataPacket.class, ClientboundRegistryDataPacket::new)
+ .registerClientboundPacket(ClientboundResourcePackPacket.class, ClientboundResourcePackPacket::new)
+ .registerClientboundPacket(ClientboundUpdateEnabledFeaturesPacket.class, ClientboundUpdateEnabledFeaturesPacket::new)
+ .registerClientboundPacket(ClientboundUpdateTagsPacket.class, ClientboundUpdateTagsPacket::new)
+ .registerServerboundPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new)
+ .registerServerboundPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new)
+ .registerServerboundPacket(ServerboundFinishConfigurationPacket.class, ServerboundFinishConfigurationPacket::new)
+ .registerServerboundPacket(ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new)
+ .registerServerboundPacket(ServerboundPongPacket.class, ServerboundPongPacket::new)
+ .registerClientboundPacket(ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new)
).state(ProtocolState.GAME, PacketStateCodec.builder()
- .registerClientboundPacket(0x00, ClientboundDelimiterPacket.class, ClientboundDelimiterPacket::new)
- .registerClientboundPacket(0x01, ClientboundAddEntityPacket.class, ClientboundAddEntityPacket::new)
- .registerClientboundPacket(0x02, ClientboundAddExperienceOrbPacket.class, ClientboundAddExperienceOrbPacket::new)
- .registerClientboundPacket(0x03, ClientboundAddPlayerPacket.class, ClientboundAddPlayerPacket::new)
- .registerClientboundPacket(0x04, ClientboundAnimatePacket.class, ClientboundAnimatePacket::new)
- .registerClientboundPacket(0x05, ClientboundAwardStatsPacket.class, ClientboundAwardStatsPacket::new)
- .registerClientboundPacket(0x06, ClientboundBlockChangedAckPacket.class, ClientboundBlockChangedAckPacket::new)
- .registerClientboundPacket(0x07, ClientboundBlockDestructionPacket.class, ClientboundBlockDestructionPacket::new)
- .registerClientboundPacket(0x08, ClientboundBlockEntityDataPacket.class, ClientboundBlockEntityDataPacket::new)
- .registerClientboundPacket(0x09, ClientboundBlockEventPacket.class, ClientboundBlockEventPacket::new)
- .registerClientboundPacket(0x0A, ClientboundBlockUpdatePacket.class, ClientboundBlockUpdatePacket::new)
- .registerClientboundPacket(0x0B, ClientboundBossEventPacket.class, ClientboundBossEventPacket::new)
- .registerClientboundPacket(0x0C, ClientboundChangeDifficultyPacket.class, ClientboundChangeDifficultyPacket::new)
- .registerClientboundPacket(0x0D, ClientboundChunksBiomesPacket.class, ClientboundChunksBiomesPacket::new)
- .registerClientboundPacket(0x0E, ClientboundClearTitlesPacket.class, ClientboundClearTitlesPacket::new)
- .registerClientboundPacket(0x0F, ClientboundCommandSuggestionsPacket.class, ClientboundCommandSuggestionsPacket::new)
- .registerClientboundPacket(0x10, ClientboundCommandsPacket.class, ClientboundCommandsPacket::new)
- .registerClientboundPacket(0x11, ClientboundContainerClosePacket.class, ClientboundContainerClosePacket::new)
- .registerClientboundPacket(0x12, ClientboundContainerSetContentPacket.class, ClientboundContainerSetContentPacket::new)
- .registerClientboundPacket(0x13, ClientboundContainerSetDataPacket.class, ClientboundContainerSetDataPacket::new)
- .registerClientboundPacket(0x14, ClientboundContainerSetSlotPacket.class, ClientboundContainerSetSlotPacket::new)
- .registerClientboundPacket(0x15, ClientboundCooldownPacket.class, ClientboundCooldownPacket::new)
- .registerClientboundPacket(0x16, ClientboundCustomChatCompletionsPacket.class, ClientboundCustomChatCompletionsPacket::new)
- .registerClientboundPacket(0x17, ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new)
- .registerClientboundPacket(0x18, ClientboundDamageEventPacket.class, ClientboundDamageEventPacket::new)
- .registerClientboundPacket(0x19, ClientboundDeleteChatPacket.class, ClientboundDeleteChatPacket::new)
- .registerClientboundPacket(0x1A, ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new)
- .registerClientboundPacket(0x1B, ClientboundDisguisedChatPacket.class, ClientboundDisguisedChatPacket::new)
- .registerClientboundPacket(0x1C, ClientboundEntityEventPacket.class, ClientboundEntityEventPacket::new)
- .registerClientboundPacket(0x1D, ClientboundExplodePacket.class, ClientboundExplodePacket::new)
- .registerClientboundPacket(0x1E, ClientboundForgetLevelChunkPacket.class, ClientboundForgetLevelChunkPacket::new)
- .registerClientboundPacket(0x1F, ClientboundGameEventPacket.class, ClientboundGameEventPacket::new)
- .registerClientboundPacket(0x20, ClientboundHorseScreenOpenPacket.class, ClientboundHorseScreenOpenPacket::new)
- .registerClientboundPacket(0x21, ClientboundHurtAnimationPacket.class, ClientboundHurtAnimationPacket::new)
- .registerClientboundPacket(0x22, ClientboundInitializeBorderPacket.class, ClientboundInitializeBorderPacket::new)
- .registerClientboundPacket(0x23, ClientboundKeepAlivePacket.class, ClientboundKeepAlivePacket::new)
- .registerClientboundPacket(0x24, ClientboundLevelChunkWithLightPacket.class, ClientboundLevelChunkWithLightPacket::new)
- .registerClientboundPacket(0x25, ClientboundLevelEventPacket.class, ClientboundLevelEventPacket::new)
- .registerClientboundPacket(0x26, ClientboundLevelParticlesPacket.class, ClientboundLevelParticlesPacket::new)
- .registerClientboundPacket(0x27, ClientboundLightUpdatePacket.class, ClientboundLightUpdatePacket::new)
- .registerClientboundPacket(0x28, ClientboundLoginPacket.class, ClientboundLoginPacket::new)
- .registerClientboundPacket(0x29, ClientboundMapItemDataPacket.class, ClientboundMapItemDataPacket::new)
- .registerClientboundPacket(0x2A, ClientboundMerchantOffersPacket.class, ClientboundMerchantOffersPacket::new)
- .registerClientboundPacket(0x2B, ClientboundMoveEntityPosPacket.class, ClientboundMoveEntityPosPacket::new)
- .registerClientboundPacket(0x2C, ClientboundMoveEntityPosRotPacket.class, ClientboundMoveEntityPosRotPacket::new)
- .registerClientboundPacket(0x2D, ClientboundMoveEntityRotPacket.class, ClientboundMoveEntityRotPacket::new)
- .registerClientboundPacket(0x2E, ClientboundMoveVehiclePacket.class, ClientboundMoveVehiclePacket::new)
- .registerClientboundPacket(0x2F, ClientboundOpenBookPacket.class, ClientboundOpenBookPacket::new)
- .registerClientboundPacket(0x30, ClientboundOpenScreenPacket.class, ClientboundOpenScreenPacket::new)
- .registerClientboundPacket(0x31, ClientboundOpenSignEditorPacket.class, ClientboundOpenSignEditorPacket::new)
- .registerClientboundPacket(0x32, ClientboundPingPacket.class, ClientboundPingPacket::new)
- .registerClientboundPacket(0x33, ClientboundPlaceGhostRecipePacket.class, ClientboundPlaceGhostRecipePacket::new)
- .registerClientboundPacket(0x34, ClientboundPlayerAbilitiesPacket.class, ClientboundPlayerAbilitiesPacket::new)
- .registerClientboundPacket(0x35, ClientboundPlayerChatPacket.class, ClientboundPlayerChatPacket::new)
- .registerClientboundPacket(0x36, ClientboundPlayerCombatEndPacket.class, ClientboundPlayerCombatEndPacket::new)
- .registerClientboundPacket(0x37, ClientboundPlayerCombatEnterPacket.class, ClientboundPlayerCombatEnterPacket::new)
- .registerClientboundPacket(0x38, ClientboundPlayerCombatKillPacket.class, ClientboundPlayerCombatKillPacket::new)
- .registerClientboundPacket(0x39, ClientboundPlayerInfoRemovePacket.class, ClientboundPlayerInfoRemovePacket::new)
- .registerClientboundPacket(0x3A, ClientboundPlayerInfoUpdatePacket.class, ClientboundPlayerInfoUpdatePacket::new)
- .registerClientboundPacket(0x3B, ClientboundPlayerLookAtPacket.class, ClientboundPlayerLookAtPacket::new)
- .registerClientboundPacket(0x3C, ClientboundPlayerPositionPacket.class, ClientboundPlayerPositionPacket::new)
- .registerClientboundPacket(0x3D, ClientboundRecipePacket.class, ClientboundRecipePacket::new)
- .registerClientboundPacket(0x3E, ClientboundRemoveEntitiesPacket.class, ClientboundRemoveEntitiesPacket::new)
- .registerClientboundPacket(0x3F, ClientboundRemoveMobEffectPacket.class, ClientboundRemoveMobEffectPacket::new)
- .registerClientboundPacket(0x40, ClientboundResourcePackPacket.class, ClientboundResourcePackPacket::new)
- .registerClientboundPacket(0x41, ClientboundRespawnPacket.class, ClientboundRespawnPacket::new)
- .registerClientboundPacket(0x42, ClientboundRotateHeadPacket.class, ClientboundRotateHeadPacket::new)
- .registerClientboundPacket(0x43, ClientboundSectionBlocksUpdatePacket.class, ClientboundSectionBlocksUpdatePacket::new)
- .registerClientboundPacket(0x44, ClientboundSelectAdvancementsTabPacket.class, ClientboundSelectAdvancementsTabPacket::new)
- .registerClientboundPacket(0x45, ClientboundServerDataPacket.class, ClientboundServerDataPacket::new)
- .registerClientboundPacket(0x46, ClientboundSetActionBarTextPacket.class, ClientboundSetActionBarTextPacket::new)
- .registerClientboundPacket(0x47, ClientboundSetBorderCenterPacket.class, ClientboundSetBorderCenterPacket::new)
- .registerClientboundPacket(0x48, ClientboundSetBorderLerpSizePacket.class, ClientboundSetBorderLerpSizePacket::new)
- .registerClientboundPacket(0x49, ClientboundSetBorderSizePacket.class, ClientboundSetBorderSizePacket::new)
- .registerClientboundPacket(0x4A, ClientboundSetBorderWarningDelayPacket.class, ClientboundSetBorderWarningDelayPacket::new)
- .registerClientboundPacket(0x4B, ClientboundSetBorderWarningDistancePacket.class, ClientboundSetBorderWarningDistancePacket::new)
- .registerClientboundPacket(0x4C, ClientboundSetCameraPacket.class, ClientboundSetCameraPacket::new)
- .registerClientboundPacket(0x4D, ClientboundSetCarriedItemPacket.class, ClientboundSetCarriedItemPacket::new)
- .registerClientboundPacket(0x4E, ClientboundSetChunkCacheCenterPacket.class, ClientboundSetChunkCacheCenterPacket::new)
- .registerClientboundPacket(0x4F, ClientboundSetChunkCacheRadiusPacket.class, ClientboundSetChunkCacheRadiusPacket::new)
- .registerClientboundPacket(0x50, ClientboundSetDefaultSpawnPositionPacket.class, ClientboundSetDefaultSpawnPositionPacket::new)
- .registerClientboundPacket(0x51, ClientboundSetDisplayObjectivePacket.class, ClientboundSetDisplayObjectivePacket::new)
- .registerClientboundPacket(0x52, ClientboundSetEntityDataPacket.class, ClientboundSetEntityDataPacket::new)
- .registerClientboundPacket(0x53, ClientboundSetEntityLinkPacket.class, ClientboundSetEntityLinkPacket::new)
- .registerClientboundPacket(0x54, ClientboundSetEntityMotionPacket.class, ClientboundSetEntityMotionPacket::new)
- .registerClientboundPacket(0x55, ClientboundSetEquipmentPacket.class, ClientboundSetEquipmentPacket::new)
- .registerClientboundPacket(0x56, ClientboundSetExperiencePacket.class, ClientboundSetExperiencePacket::new)
- .registerClientboundPacket(0x57, ClientboundSetHealthPacket.class, ClientboundSetHealthPacket::new)
- .registerClientboundPacket(0x58, ClientboundSetObjectivePacket.class, ClientboundSetObjectivePacket::new)
- .registerClientboundPacket(0x59, ClientboundSetPassengersPacket.class, ClientboundSetPassengersPacket::new)
- .registerClientboundPacket(0x5A, ClientboundSetPlayerTeamPacket.class, ClientboundSetPlayerTeamPacket::new)
- .registerClientboundPacket(0x5B, ClientboundSetScorePacket.class, ClientboundSetScorePacket::new)
- .registerClientboundPacket(0x5C, ClientboundSetSimulationDistancePacket.class, ClientboundSetSimulationDistancePacket::new)
- .registerClientboundPacket(0x5D, ClientboundSetSubtitleTextPacket.class, ClientboundSetSubtitleTextPacket::new)
- .registerClientboundPacket(0x5E, ClientboundSetTimePacket.class, ClientboundSetTimePacket::new)
- .registerClientboundPacket(0x5F, ClientboundSetTitleTextPacket.class, ClientboundSetTitleTextPacket::new)
- .registerClientboundPacket(0x60, ClientboundSetTitlesAnimationPacket.class, ClientboundSetTitlesAnimationPacket::new)
- .registerClientboundPacket(0x61, ClientboundSoundEntityPacket.class, ClientboundSoundEntityPacket::new)
- .registerClientboundPacket(0x62, ClientboundSoundPacket.class, ClientboundSoundPacket::new)
- .registerClientboundPacket(0x63, ClientboundStopSoundPacket.class, ClientboundStopSoundPacket::new)
- .registerClientboundPacket(0x64, ClientboundSystemChatPacket.class, ClientboundSystemChatPacket::new)
- .registerClientboundPacket(0x65, ClientboundTabListPacket.class, ClientboundTabListPacket::new)
- .registerClientboundPacket(0x66, ClientboundTagQueryPacket.class, ClientboundTagQueryPacket::new)
- .registerClientboundPacket(0x67, ClientboundTakeItemEntityPacket.class, ClientboundTakeItemEntityPacket::new)
- .registerClientboundPacket(0x68, ClientboundTeleportEntityPacket.class, ClientboundTeleportEntityPacket::new)
- .registerClientboundPacket(0x69, ClientboundUpdateAdvancementsPacket.class, ClientboundUpdateAdvancementsPacket::new)
- .registerClientboundPacket(0x6A, ClientboundUpdateAttributesPacket.class, ClientboundUpdateAttributesPacket::new)
- .registerClientboundPacket(0x6B, ClientboundUpdateEnabledFeaturesPacket.class, ClientboundUpdateEnabledFeaturesPacket::new)
- .registerClientboundPacket(0x6C, ClientboundUpdateMobEffectPacket.class, ClientboundUpdateMobEffectPacket::new)
- .registerClientboundPacket(0x6D, ClientboundUpdateRecipesPacket.class, ClientboundUpdateRecipesPacket::new)
- .registerClientboundPacket(0x6E, ClientboundUpdateTagsPacket.class, ClientboundUpdateTagsPacket::new)
- .registerServerboundPacket(0x00, ServerboundAcceptTeleportationPacket.class, ServerboundAcceptTeleportationPacket::new)
- .registerServerboundPacket(0x01, ServerboundBlockEntityTagQuery.class, ServerboundBlockEntityTagQuery::new)
- .registerServerboundPacket(0x02, ServerboundChangeDifficultyPacket.class, ServerboundChangeDifficultyPacket::new)
- .registerServerboundPacket(0x03, ServerboundChatAckPacket.class, ServerboundChatAckPacket::new)
- .registerServerboundPacket(0x04, ServerboundChatCommandPacket.class, ServerboundChatCommandPacket::new)
- .registerServerboundPacket(0x05, ServerboundChatPacket.class, ServerboundChatPacket::new)
- .registerServerboundPacket(0x06, ServerboundChatSessionUpdatePacket.class, ServerboundChatSessionUpdatePacket::new)
- .registerServerboundPacket(0x07, ServerboundClientCommandPacket.class, ServerboundClientCommandPacket::new)
- .registerServerboundPacket(0x08, ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new)
- .registerServerboundPacket(0x09, ServerboundCommandSuggestionPacket.class, ServerboundCommandSuggestionPacket::new)
- .registerServerboundPacket(0x0A, ServerboundContainerButtonClickPacket.class, ServerboundContainerButtonClickPacket::new)
- .registerServerboundPacket(0x0B, ServerboundContainerClickPacket.class, ServerboundContainerClickPacket::new)
- .registerServerboundPacket(0x0C, ServerboundContainerClosePacket.class, ServerboundContainerClosePacket::new)
- .registerServerboundPacket(0x0D, ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new)
- .registerServerboundPacket(0x0E, ServerboundEditBookPacket.class, ServerboundEditBookPacket::new)
- .registerServerboundPacket(0x0F, ServerboundEntityTagQuery.class, ServerboundEntityTagQuery::new)
- .registerServerboundPacket(0x10, ServerboundInteractPacket.class, ServerboundInteractPacket::new)
- .registerServerboundPacket(0x11, ServerboundJigsawGeneratePacket.class, ServerboundJigsawGeneratePacket::new)
- .registerServerboundPacket(0x12, ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new)
- .registerServerboundPacket(0x13, ServerboundLockDifficultyPacket.class, ServerboundLockDifficultyPacket::new)
- .registerServerboundPacket(0x14, ServerboundMovePlayerPosPacket.class, ServerboundMovePlayerPosPacket::new)
- .registerServerboundPacket(0x15, ServerboundMovePlayerPosRotPacket.class, ServerboundMovePlayerPosRotPacket::new)
- .registerServerboundPacket(0x16, ServerboundMovePlayerRotPacket.class, ServerboundMovePlayerRotPacket::new)
- .registerServerboundPacket(0x17, ServerboundMovePlayerStatusOnlyPacket.class, ServerboundMovePlayerStatusOnlyPacket::new)
- .registerServerboundPacket(0x18, ServerboundMoveVehiclePacket.class, ServerboundMoveVehiclePacket::new)
- .registerServerboundPacket(0x19, ServerboundPaddleBoatPacket.class, ServerboundPaddleBoatPacket::new)
- .registerServerboundPacket(0x1A, ServerboundPickItemPacket.class, ServerboundPickItemPacket::new)
- .registerServerboundPacket(0x1B, ServerboundPlaceRecipePacket.class, ServerboundPlaceRecipePacket::new)
- .registerServerboundPacket(0x1C, ServerboundPlayerAbilitiesPacket.class, ServerboundPlayerAbilitiesPacket::new)
- .registerServerboundPacket(0x1D, ServerboundPlayerActionPacket.class, ServerboundPlayerActionPacket::new)
- .registerServerboundPacket(0x1E, ServerboundPlayerCommandPacket.class, ServerboundPlayerCommandPacket::new)
- .registerServerboundPacket(0x1F, ServerboundPlayerInputPacket.class, ServerboundPlayerInputPacket::new)
- .registerServerboundPacket(0x20, ServerboundPongPacket.class, ServerboundPongPacket::new)
- .registerServerboundPacket(0x21, ServerboundRecipeBookChangeSettingsPacket.class, ServerboundRecipeBookChangeSettingsPacket::new)
- .registerServerboundPacket(0x22, ServerboundRecipeBookSeenRecipePacket.class, ServerboundRecipeBookSeenRecipePacket::new)
- .registerServerboundPacket(0x23, ServerboundRenameItemPacket.class, ServerboundRenameItemPacket::new)
- .registerServerboundPacket(0x24, ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new)
- .registerServerboundPacket(0x25, ServerboundSeenAdvancementsPacket.class, ServerboundSeenAdvancementsPacket::new)
- .registerServerboundPacket(0x26, ServerboundSelectTradePacket.class, ServerboundSelectTradePacket::new)
- .registerServerboundPacket(0x27, ServerboundSetBeaconPacket.class, ServerboundSetBeaconPacket::new)
- .registerServerboundPacket(0x28, ServerboundSetCarriedItemPacket.class, ServerboundSetCarriedItemPacket::new)
- .registerServerboundPacket(0x29, ServerboundSetCommandBlockPacket.class, ServerboundSetCommandBlockPacket::new)
- .registerServerboundPacket(0x2A, ServerboundSetCommandMinecartPacket.class, ServerboundSetCommandMinecartPacket::new)
- .registerServerboundPacket(0x2B, ServerboundSetCreativeModeSlotPacket.class, ServerboundSetCreativeModeSlotPacket::new)
- .registerServerboundPacket(0x2C, ServerboundSetJigsawBlockPacket.class, ServerboundSetJigsawBlockPacket::new)
- .registerServerboundPacket(0x2D, ServerboundSetStructureBlockPacket.class, ServerboundSetStructureBlockPacket::new)
- .registerServerboundPacket(0x2E, ServerboundSignUpdatePacket.class, ServerboundSignUpdatePacket::new)
- .registerServerboundPacket(0x2F, ServerboundSwingPacket.class, ServerboundSwingPacket::new)
- .registerServerboundPacket(0x30, ServerboundTeleportToEntityPacket.class, ServerboundTeleportToEntityPacket::new)
- .registerServerboundPacket(0x31, ServerboundUseItemOnPacket.class, ServerboundUseItemOnPacket::new)
- .registerServerboundPacket(0x32, ServerboundUseItemPacket.class, ServerboundUseItemPacket::new)
+ .registerClientboundPacket(ClientboundDelimiterPacket.class, ClientboundDelimiterPacket::new)
+ .registerClientboundPacket(ClientboundAddEntityPacket.class, ClientboundAddEntityPacket::new)
+ .registerClientboundPacket(ClientboundAddExperienceOrbPacket.class, ClientboundAddExperienceOrbPacket::new)
+ .registerClientboundPacket(ClientboundAnimatePacket.class, ClientboundAnimatePacket::new)
+ .registerClientboundPacket(ClientboundAwardStatsPacket.class, ClientboundAwardStatsPacket::new)
+ .registerClientboundPacket(ClientboundBlockChangedAckPacket.class, ClientboundBlockChangedAckPacket::new)
+ .registerClientboundPacket(ClientboundBlockDestructionPacket.class, ClientboundBlockDestructionPacket::new)
+ .registerClientboundPacket(ClientboundBlockEntityDataPacket.class, ClientboundBlockEntityDataPacket::new)
+ .registerClientboundPacket(ClientboundBlockEventPacket.class, ClientboundBlockEventPacket::new)
+ .registerClientboundPacket(ClientboundBlockUpdatePacket.class, ClientboundBlockUpdatePacket::new)
+ .registerClientboundPacket(ClientboundBossEventPacket.class, ClientboundBossEventPacket::new)
+ .registerClientboundPacket(ClientboundChangeDifficultyPacket.class, ClientboundChangeDifficultyPacket::new)
+ .registerClientboundPacket(ClientboundChunkBatchFinishedPacket.class, ClientboundChunkBatchFinishedPacket::new)
+ .registerClientboundPacket(ClientboundChunkBatchStartPacket.class, ClientboundChunkBatchStartPacket::new)
+ .registerClientboundPacket(ClientboundChunksBiomesPacket.class, ClientboundChunksBiomesPacket::new)
+ .registerClientboundPacket(ClientboundClearTitlesPacket.class, ClientboundClearTitlesPacket::new)
+ .registerClientboundPacket(ClientboundCommandSuggestionsPacket.class, ClientboundCommandSuggestionsPacket::new)
+ .registerClientboundPacket(ClientboundCommandsPacket.class, ClientboundCommandsPacket::new)
+ .registerClientboundPacket(ClientboundContainerClosePacket.class, ClientboundContainerClosePacket::new)
+ .registerClientboundPacket(ClientboundContainerSetContentPacket.class, ClientboundContainerSetContentPacket::new)
+ .registerClientboundPacket(ClientboundContainerSetDataPacket.class, ClientboundContainerSetDataPacket::new)
+ .registerClientboundPacket(ClientboundContainerSetSlotPacket.class, ClientboundContainerSetSlotPacket::new)
+ .registerClientboundPacket(ClientboundCooldownPacket.class, ClientboundCooldownPacket::new)
+ .registerClientboundPacket(ClientboundCustomChatCompletionsPacket.class, ClientboundCustomChatCompletionsPacket::new)
+ .registerClientboundPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new)
+ .registerClientboundPacket(ClientboundDamageEventPacket.class, ClientboundDamageEventPacket::new)
+ .registerClientboundPacket(ClientboundDeleteChatPacket.class, ClientboundDeleteChatPacket::new)
+ .registerClientboundPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new)
+ .registerClientboundPacket(ClientboundDisguisedChatPacket.class, ClientboundDisguisedChatPacket::new)
+ .registerClientboundPacket(ClientboundEntityEventPacket.class, ClientboundEntityEventPacket::new)
+ .registerClientboundPacket(ClientboundExplodePacket.class, ClientboundExplodePacket::new)
+ .registerClientboundPacket(ClientboundForgetLevelChunkPacket.class, ClientboundForgetLevelChunkPacket::new)
+ .registerClientboundPacket(ClientboundGameEventPacket.class, ClientboundGameEventPacket::new)
+ .registerClientboundPacket(ClientboundHorseScreenOpenPacket.class, ClientboundHorseScreenOpenPacket::new)
+ .registerClientboundPacket(ClientboundHurtAnimationPacket.class, ClientboundHurtAnimationPacket::new)
+ .registerClientboundPacket(ClientboundInitializeBorderPacket.class, ClientboundInitializeBorderPacket::new)
+ .registerClientboundPacket(ClientboundKeepAlivePacket.class, ClientboundKeepAlivePacket::new)
+ .registerClientboundPacket(ClientboundLevelChunkWithLightPacket.class, ClientboundLevelChunkWithLightPacket::new)
+ .registerClientboundPacket(ClientboundLevelEventPacket.class, ClientboundLevelEventPacket::new)
+ .registerClientboundPacket(ClientboundLevelParticlesPacket.class, ClientboundLevelParticlesPacket::new)
+ .registerClientboundPacket(ClientboundLightUpdatePacket.class, ClientboundLightUpdatePacket::new)
+ .registerClientboundPacket(ClientboundLoginPacket.class, ClientboundLoginPacket::new)
+ .registerClientboundPacket(ClientboundMapItemDataPacket.class, ClientboundMapItemDataPacket::new)
+ .registerClientboundPacket(ClientboundMerchantOffersPacket.class, ClientboundMerchantOffersPacket::new)
+ .registerClientboundPacket(ClientboundMoveEntityPosPacket.class, ClientboundMoveEntityPosPacket::new)
+ .registerClientboundPacket(ClientboundMoveEntityPosRotPacket.class, ClientboundMoveEntityPosRotPacket::new)
+ .registerClientboundPacket(ClientboundMoveEntityRotPacket.class, ClientboundMoveEntityRotPacket::new)
+ .registerClientboundPacket(ClientboundMoveVehiclePacket.class, ClientboundMoveVehiclePacket::new)
+ .registerClientboundPacket(ClientboundOpenBookPacket.class, ClientboundOpenBookPacket::new)
+ .registerClientboundPacket(ClientboundOpenScreenPacket.class, ClientboundOpenScreenPacket::new)
+ .registerClientboundPacket(ClientboundOpenSignEditorPacket.class, ClientboundOpenSignEditorPacket::new)
+ .registerClientboundPacket(ClientboundPingPacket.class, ClientboundPingPacket::new)
+ .registerClientboundPacket(ClientboundPongResponsePacket.class, ClientboundPongResponsePacket::new)
+ .registerClientboundPacket(ClientboundPlaceGhostRecipePacket.class, ClientboundPlaceGhostRecipePacket::new)
+ .registerClientboundPacket(ClientboundPlayerAbilitiesPacket.class, ClientboundPlayerAbilitiesPacket::new)
+ .registerClientboundPacket(ClientboundPlayerChatPacket.class, ClientboundPlayerChatPacket::new)
+ .registerClientboundPacket(ClientboundPlayerCombatEndPacket.class, ClientboundPlayerCombatEndPacket::new)
+ .registerClientboundPacket(ClientboundPlayerCombatEnterPacket.class, ClientboundPlayerCombatEnterPacket::new)
+ .registerClientboundPacket(ClientboundPlayerCombatKillPacket.class, ClientboundPlayerCombatKillPacket::new)
+ .registerClientboundPacket(ClientboundPlayerInfoRemovePacket.class, ClientboundPlayerInfoRemovePacket::new)
+ .registerClientboundPacket(ClientboundPlayerInfoUpdatePacket.class, ClientboundPlayerInfoUpdatePacket::new)
+ .registerClientboundPacket(ClientboundPlayerLookAtPacket.class, ClientboundPlayerLookAtPacket::new)
+ .registerClientboundPacket(ClientboundPlayerPositionPacket.class, ClientboundPlayerPositionPacket::new)
+ .registerClientboundPacket(ClientboundRecipePacket.class, ClientboundRecipePacket::new)
+ .registerClientboundPacket(ClientboundRemoveEntitiesPacket.class, ClientboundRemoveEntitiesPacket::new)
+ .registerClientboundPacket(ClientboundRemoveMobEffectPacket.class, ClientboundRemoveMobEffectPacket::new)
+ .registerClientboundPacket(ClientboundResourcePackPacket.class, ClientboundResourcePackPacket::new)
+ .registerClientboundPacket(ClientboundRespawnPacket.class, ClientboundRespawnPacket::new)
+ .registerClientboundPacket(ClientboundRotateHeadPacket.class, ClientboundRotateHeadPacket::new)
+ .registerClientboundPacket(ClientboundSectionBlocksUpdatePacket.class, ClientboundSectionBlocksUpdatePacket::new)
+ .registerClientboundPacket(ClientboundSelectAdvancementsTabPacket.class, ClientboundSelectAdvancementsTabPacket::new)
+ .registerClientboundPacket(ClientboundServerDataPacket.class, ClientboundServerDataPacket::new)
+ .registerClientboundPacket(ClientboundSetActionBarTextPacket.class, ClientboundSetActionBarTextPacket::new)
+ .registerClientboundPacket(ClientboundSetBorderCenterPacket.class, ClientboundSetBorderCenterPacket::new)
+ .registerClientboundPacket(ClientboundSetBorderLerpSizePacket.class, ClientboundSetBorderLerpSizePacket::new)
+ .registerClientboundPacket(ClientboundSetBorderSizePacket.class, ClientboundSetBorderSizePacket::new)
+ .registerClientboundPacket(ClientboundSetBorderWarningDelayPacket.class, ClientboundSetBorderWarningDelayPacket::new)
+ .registerClientboundPacket(ClientboundSetBorderWarningDistancePacket.class, ClientboundSetBorderWarningDistancePacket::new)
+ .registerClientboundPacket(ClientboundSetCameraPacket.class, ClientboundSetCameraPacket::new)
+ .registerClientboundPacket(ClientboundSetCarriedItemPacket.class, ClientboundSetCarriedItemPacket::new)
+ .registerClientboundPacket(ClientboundSetChunkCacheCenterPacket.class, ClientboundSetChunkCacheCenterPacket::new)
+ .registerClientboundPacket(ClientboundSetChunkCacheRadiusPacket.class, ClientboundSetChunkCacheRadiusPacket::new)
+ .registerClientboundPacket(ClientboundSetDefaultSpawnPositionPacket.class, ClientboundSetDefaultSpawnPositionPacket::new)
+ .registerClientboundPacket(ClientboundSetDisplayObjectivePacket.class, ClientboundSetDisplayObjectivePacket::new)
+ .registerClientboundPacket(ClientboundSetEntityDataPacket.class, ClientboundSetEntityDataPacket::new)
+ .registerClientboundPacket(ClientboundSetEntityLinkPacket.class, ClientboundSetEntityLinkPacket::new)
+ .registerClientboundPacket(ClientboundSetEntityMotionPacket.class, ClientboundSetEntityMotionPacket::new)
+ .registerClientboundPacket(ClientboundSetEquipmentPacket.class, ClientboundSetEquipmentPacket::new)
+ .registerClientboundPacket(ClientboundSetExperiencePacket.class, ClientboundSetExperiencePacket::new)
+ .registerClientboundPacket(ClientboundSetHealthPacket.class, ClientboundSetHealthPacket::new)
+ .registerClientboundPacket(ClientboundSetObjectivePacket.class, ClientboundSetObjectivePacket::new)
+ .registerClientboundPacket(ClientboundSetPassengersPacket.class, ClientboundSetPassengersPacket::new)
+ .registerClientboundPacket(ClientboundSetPlayerTeamPacket.class, ClientboundSetPlayerTeamPacket::new)
+ .registerClientboundPacket(ClientboundSetScorePacket.class, ClientboundSetScorePacket::new)
+ .registerClientboundPacket(ClientboundSetSimulationDistancePacket.class, ClientboundSetSimulationDistancePacket::new)
+ .registerClientboundPacket(ClientboundSetSubtitleTextPacket.class, ClientboundSetSubtitleTextPacket::new)
+ .registerClientboundPacket(ClientboundSetTimePacket.class, ClientboundSetTimePacket::new)
+ .registerClientboundPacket(ClientboundSetTitleTextPacket.class, ClientboundSetTitleTextPacket::new)
+ .registerClientboundPacket(ClientboundSetTitlesAnimationPacket.class, ClientboundSetTitlesAnimationPacket::new)
+ .registerClientboundPacket(ClientboundSoundEntityPacket.class, ClientboundSoundEntityPacket::new)
+ .registerClientboundPacket(ClientboundSoundPacket.class, ClientboundSoundPacket::new)
+ .registerClientboundPacket(ClientboundStartConfigurationPacket.class, ClientboundStartConfigurationPacket::new)
+ .registerClientboundPacket(ClientboundStopSoundPacket.class, ClientboundStopSoundPacket::new)
+ .registerClientboundPacket(ClientboundSystemChatPacket.class, ClientboundSystemChatPacket::new)
+ .registerClientboundPacket(ClientboundTabListPacket.class, ClientboundTabListPacket::new)
+ .registerClientboundPacket(ClientboundTagQueryPacket.class, ClientboundTagQueryPacket::new)
+ .registerClientboundPacket(ClientboundTakeItemEntityPacket.class, ClientboundTakeItemEntityPacket::new)
+ .registerClientboundPacket(ClientboundTeleportEntityPacket.class, ClientboundTeleportEntityPacket::new)
+ .registerClientboundPacket(ClientboundUpdateAdvancementsPacket.class, ClientboundUpdateAdvancementsPacket::new)
+ .registerClientboundPacket(ClientboundUpdateAttributesPacket.class, ClientboundUpdateAttributesPacket::new)
+ .registerClientboundPacket(ClientboundUpdateMobEffectPacket.class, ClientboundUpdateMobEffectPacket::new)
+ .registerClientboundPacket(ClientboundUpdateRecipesPacket.class, ClientboundUpdateRecipesPacket::new)
+ .registerClientboundPacket(ClientboundUpdateTagsPacket.class, ClientboundUpdateTagsPacket::new)
+ .registerServerboundPacket(ServerboundAcceptTeleportationPacket.class, ServerboundAcceptTeleportationPacket::new)
+ .registerServerboundPacket(ServerboundBlockEntityTagQuery.class, ServerboundBlockEntityTagQuery::new)
+ .registerServerboundPacket(ServerboundChangeDifficultyPacket.class, ServerboundChangeDifficultyPacket::new)
+ .registerServerboundPacket(ServerboundChatAckPacket.class, ServerboundChatAckPacket::new)
+ .registerServerboundPacket(ServerboundChatCommandPacket.class, ServerboundChatCommandPacket::new)
+ .registerServerboundPacket(ServerboundChatPacket.class, ServerboundChatPacket::new)
+ .registerServerboundPacket(ServerboundChatSessionUpdatePacket.class, ServerboundChatSessionUpdatePacket::new)
+ .registerServerboundPacket(ServerboundChunkBatchReceivedPacket.class, ServerboundChunkBatchReceivedPacket::new)
+ .registerServerboundPacket(ServerboundClientCommandPacket.class, ServerboundClientCommandPacket::new)
+ .registerServerboundPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new)
+ .registerServerboundPacket(ServerboundCommandSuggestionPacket.class, ServerboundCommandSuggestionPacket::new)
+ .registerServerboundPacket(ServerboundConfigurationAcknowledgedPacket.class, ServerboundConfigurationAcknowledgedPacket::new)
+ .registerServerboundPacket(ServerboundContainerButtonClickPacket.class, ServerboundContainerButtonClickPacket::new)
+ .registerServerboundPacket(ServerboundContainerClickPacket.class, ServerboundContainerClickPacket::new)
+ .registerServerboundPacket(ServerboundContainerClosePacket.class, ServerboundContainerClosePacket::new)
+ .registerServerboundPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new)
+ .registerServerboundPacket(ServerboundEditBookPacket.class, ServerboundEditBookPacket::new)
+ .registerServerboundPacket(ServerboundEntityTagQuery.class, ServerboundEntityTagQuery::new)
+ .registerServerboundPacket(ServerboundInteractPacket.class, ServerboundInteractPacket::new)
+ .registerServerboundPacket(ServerboundJigsawGeneratePacket.class, ServerboundJigsawGeneratePacket::new)
+ .registerServerboundPacket(ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new)
+ .registerServerboundPacket(ServerboundLockDifficultyPacket.class, ServerboundLockDifficultyPacket::new)
+ .registerServerboundPacket(ServerboundMovePlayerPosPacket.class, ServerboundMovePlayerPosPacket::new)
+ .registerServerboundPacket(ServerboundMovePlayerPosRotPacket.class, ServerboundMovePlayerPosRotPacket::new)
+ .registerServerboundPacket(ServerboundMovePlayerRotPacket.class, ServerboundMovePlayerRotPacket::new)
+ .registerServerboundPacket(ServerboundMovePlayerStatusOnlyPacket.class, ServerboundMovePlayerStatusOnlyPacket::new)
+ .registerServerboundPacket(ServerboundMoveVehiclePacket.class, ServerboundMoveVehiclePacket::new)
+ .registerServerboundPacket(ServerboundPaddleBoatPacket.class, ServerboundPaddleBoatPacket::new)
+ .registerServerboundPacket(ServerboundPickItemPacket.class, ServerboundPickItemPacket::new)
+ .registerServerboundPacket(ServerboundPingRequestPacket.class, ServerboundPingRequestPacket::new)
+ .registerServerboundPacket(ServerboundPlaceRecipePacket.class, ServerboundPlaceRecipePacket::new)
+ .registerServerboundPacket(ServerboundPlayerAbilitiesPacket.class, ServerboundPlayerAbilitiesPacket::new)
+ .registerServerboundPacket(ServerboundPlayerActionPacket.class, ServerboundPlayerActionPacket::new)
+ .registerServerboundPacket(ServerboundPlayerCommandPacket.class, ServerboundPlayerCommandPacket::new)
+ .registerServerboundPacket(ServerboundPlayerInputPacket.class, ServerboundPlayerInputPacket::new)
+ .registerServerboundPacket(ServerboundPongPacket.class, ServerboundPongPacket::new)
+ .registerServerboundPacket(ServerboundRecipeBookChangeSettingsPacket.class, ServerboundRecipeBookChangeSettingsPacket::new)
+ .registerServerboundPacket(ServerboundRecipeBookSeenRecipePacket.class, ServerboundRecipeBookSeenRecipePacket::new)
+ .registerServerboundPacket(ServerboundRenameItemPacket.class, ServerboundRenameItemPacket::new)
+ .registerServerboundPacket(ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new)
+ .registerServerboundPacket(ServerboundSeenAdvancementsPacket.class, ServerboundSeenAdvancementsPacket::new)
+ .registerServerboundPacket(ServerboundSelectTradePacket.class, ServerboundSelectTradePacket::new)
+ .registerServerboundPacket(ServerboundSetBeaconPacket.class, ServerboundSetBeaconPacket::new)
+ .registerServerboundPacket(ServerboundSetCarriedItemPacket.class, ServerboundSetCarriedItemPacket::new)
+ .registerServerboundPacket(ServerboundSetCommandBlockPacket.class, ServerboundSetCommandBlockPacket::new)
+ .registerServerboundPacket(ServerboundSetCommandMinecartPacket.class, ServerboundSetCommandMinecartPacket::new)
+ .registerServerboundPacket(ServerboundSetCreativeModeSlotPacket.class, ServerboundSetCreativeModeSlotPacket::new)
+ .registerServerboundPacket(ServerboundSetJigsawBlockPacket.class, ServerboundSetJigsawBlockPacket::new)
+ .registerServerboundPacket(ServerboundSetStructureBlockPacket.class, ServerboundSetStructureBlockPacket::new)
+ .registerServerboundPacket(ServerboundSignUpdatePacket.class, ServerboundSignUpdatePacket::new)
+ .registerServerboundPacket(ServerboundSwingPacket.class, ServerboundSwingPacket::new)
+ .registerServerboundPacket(ServerboundTeleportToEntityPacket.class, ServerboundTeleportToEntityPacket::new)
+ .registerServerboundPacket(ServerboundUseItemOnPacket.class, ServerboundUseItemOnPacket::new)
+ .registerServerboundPacket(ServerboundUseItemPacket.class, ServerboundUseItemPacket::new)
)
.build();
}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/codec/MinecraftCodecHelper.java b/src/main/java/com/github/steveice10/mc/protocol/codec/MinecraftCodecHelper.java
index 64066740e..9bf65eb6d 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/codec/MinecraftCodecHelper.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/codec/MinecraftCodecHelper.java
@@ -25,6 +25,8 @@
import com.github.steveice10.mc.protocol.data.game.entity.metadata.VillagerData;
import com.github.steveice10.mc.protocol.data.game.entity.object.Direction;
import com.github.steveice10.mc.protocol.data.game.entity.player.BlockBreakStage;
+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.game.entity.type.PaintingType;
import com.github.steveice10.mc.protocol.data.game.level.LightUpdateData;
import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
@@ -203,6 +205,30 @@ public int read() {
return expected.cast(tag);
}
+ public CompoundTag readAnyTag(ByteBuf buf) throws IOException {
+ return readAnyTag(buf, CompoundTag.class);
+ }
+
+ @Nullable
+ public T readAnyTag(ByteBuf buf, Class expected) throws IOException {
+ Tag tag = NBTIO.readAnyTag(new InputStream() {
+ @Override
+ public int read() {
+ return buf.readUnsignedByte();
+ }
+ });
+
+ if (tag == null) {
+ return null;
+ }
+
+ if (tag.getClass() != expected) {
+ throw new IllegalArgumentException("Expected tag of type " + expected.getName() + " but got " + tag.getClass().getName());
+ }
+
+ return expected.cast(tag);
+ }
+
public CompoundTag readTagLE(ByteBuf buf) throws IOException {
return readTagLE(buf, CompoundTag.class);
}
@@ -236,6 +262,15 @@ public void write(int b) throws IOException {
}, tag);
}
+ public void writeAnyTag(ByteBuf buf, T tag) throws IOException {
+ NBTIO.writeAnyTag(new OutputStream() {
+ @Override
+ public void write(int b) throws IOException {
+ buf.writeByte(b);
+ }
+ }, tag);
+ }
+
public void writeTagLE(ByteBuf buf, T tag) throws IOException {
NBTIO.writeTag(new OutputStream() {
@Override
@@ -252,7 +287,7 @@ public ItemStack readItemStack(ByteBuf buf) throws IOException {
}
int item = this.readVarInt(buf);
- return new ItemStack(item, buf.readByte(), this.readTag(buf));
+ return new ItemStack(item, buf.readByte(), this.readAnyTag(buf));
}
public void writeItemStack(ByteBuf buf, ItemStack item) throws IOException {
@@ -260,7 +295,7 @@ public void writeItemStack(ByteBuf buf, ItemStack item) throws IOException {
if (item != null) {
this.writeVarInt(buf, item.getId());
buf.writeByte(item.getAmount());
- this.writeTag(buf, item.getNbt());
+ this.writeAnyTag(buf, item.getNbt());
}
}
@@ -409,6 +444,31 @@ public void writeGlobalPos(ByteBuf buf, GlobalPos pos) {
this.writePosition(buf, pos.getPosition());
}
+ public PlayerSpawnInfo readPlayerSpawnInfo(ByteBuf buf) {
+ String dimension = this.readString(buf);
+ String worldName = this.readString(buf);
+ long hashedSeed = buf.readLong();
+ GameMode gameMode = GameMode.byId(buf.readByte());
+ GameMode previousGamemode = GameMode.byNullableId(buf.readByte());
+ boolean debug = buf.readBoolean();
+ boolean flat = buf.readBoolean();
+ GlobalPos lastDeathPos = this.readNullable(buf, this::readGlobalPos);
+ int portalCooldown = this.readVarInt(buf);
+ return new PlayerSpawnInfo(dimension, worldName, hashedSeed, gameMode, previousGamemode, debug, flat, lastDeathPos, portalCooldown);
+ }
+
+ public void writePlayerSpawnInfo(ByteBuf buf, PlayerSpawnInfo info) {
+ this.writeString(buf, info.getDimension());
+ this.writeString(buf, info.getWorldName());
+ buf.writeLong(info.getHashedSeed());
+ buf.writeByte(info.getGameMode().ordinal());
+ buf.writeByte(GameMode.toNullableId(info.getPreviousGamemode()));
+ buf.writeBoolean(info.isDebug());
+ buf.writeBoolean(info.isFlat());
+ this.writeNullable(buf, info.getLastDeathPos(), this::writeGlobalPos);
+ this.writeVarInt(buf, info.getPortalCooldown());
+ }
+
public ParticleType readParticleType(ByteBuf buf) {
return ParticleType.from(this.readVarInt(buf));
}
@@ -786,20 +846,14 @@ public void writeFixedBitSet(ByteBuf buf, BitSet bitSet, int length) {
public GameProfile.Property readProperty(ByteBuf buf) {
String name = this.readString(buf);
String value = this.readString(buf);
- if (buf.readBoolean()) {
- return new GameProfile.Property(name, value, this.readString(buf));
- } else {
- return new GameProfile.Property(name, value);
- }
+ String signature = this.readNullable(buf, this::readString);
+ return new GameProfile.Property(name, value, signature);
}
public void writeProperty(ByteBuf buf, GameProfile.Property property) {
this.writeString(buf, property.getName());
this.writeString(buf, property.getValue());
- buf.writeBoolean(property.hasSignature());
- if (property.hasSignature()) {
- this.writeString(buf, property.getSignature());
- }
+ this.writeNullable(buf, property.getSignature(), this::writeString);
}
public T readById(ByteBuf buf, IntFunction registry, Function custom) {
diff --git a/src/main/java/com/github/steveice10/mc/protocol/codec/PacketStateCodec.java b/src/main/java/com/github/steveice10/mc/protocol/codec/PacketStateCodec.java
index 2b76d9413..7d01cf568 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/codec/PacketStateCodec.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/codec/PacketStateCodec.java
@@ -46,13 +46,28 @@ public static class Builder {
private final Map> clientboundPackets = new HashMap<>();
private final Map> serverboundPackets = new HashMap<>();
+ private int nextClientboundId = 0x00;
+ private int nextServerboundId = 0x00;
+
public Builder registerClientboundPacket(int id, Class packetClass, PacketFactory factory) {
- this.clientboundPackets.put(id, new PacketDefinition<>(id, packetClass, new MinecraftPacketSerializer<>(factory)));
+ this.nextClientboundId = id;
+ return registerClientboundPacket(packetClass, factory);
+ }
+
+ public Builder registerClientboundPacket(Class packetClass, PacketFactory factory) {
+ this.clientboundPackets.put(nextClientboundId, new PacketDefinition<>(nextClientboundId, packetClass, new MinecraftPacketSerializer<>(factory)));
+ this.nextClientboundId++;
return this;
}
public Builder registerServerboundPacket(int id, Class packetClass, PacketFactory factory) {
- this.serverboundPackets.put(id, new PacketDefinition<>(id, packetClass, new MinecraftPacketSerializer<>(factory)));
+ this.nextServerboundId = id;
+ return registerServerboundPacket(packetClass, factory);
+ }
+
+ public Builder registerServerboundPacket(Class packetClass, PacketFactory factory) {
+ this.serverboundPackets.put(nextServerboundId, new PacketDefinition<>(nextServerboundId, packetClass, new MinecraftPacketSerializer<>(factory)));
+ this.nextServerboundId++;
return this;
}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/ProtocolState.java b/src/main/java/com/github/steveice10/mc/protocol/data/ProtocolState.java
index 9f4e18397..e31e1385f 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/data/ProtocolState.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/data/ProtocolState.java
@@ -4,5 +4,6 @@ public enum ProtocolState {
HANDSHAKE,
LOGIN,
GAME,
- STATUS;
+ STATUS,
+ CONFIGURATION;
}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/PlayerListEntry.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/PlayerListEntry.java
index dbdfeea0f..27a97d395 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/data/game/PlayerListEntry.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/PlayerListEntry.java
@@ -15,7 +15,7 @@
@AllArgsConstructor
public class PlayerListEntry {
private final @NonNull UUID profileId;
- private @NonNull GameProfile profile;
+ private @Nullable GameProfile profile;
private boolean listed;
private int latency;
private GameMode gameMode;
@@ -26,6 +26,6 @@ public class PlayerListEntry {
private byte @Nullable[] keySignature;
public PlayerListEntry(UUID profileId) {
- this(profileId, new GameProfile(profileId, null), false, 0, GameMode.SURVIVAL, null, null, 0, null, null);
+ this(profileId, null, false, 0, GameMode.SURVIVAL, null, null, 0, null, null);
}
}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/advancement/Advancement.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/advancement/Advancement.java
index 5593434bb..0967f9fe7 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/data/game/advancement/Advancement.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/advancement/Advancement.java
@@ -12,22 +12,21 @@
@AllArgsConstructor
public class Advancement {
private final @NonNull String id;
- private final @NonNull List criteria;
private final @NonNull List> requirements;
private final String parentId;
private final DisplayData displayData;
private final boolean sendsTelemetryEvent;
- public Advancement(@NonNull String id, @NonNull List criteria, @NonNull List> requirements, boolean sendsTelemetryEvent) {
- this(id, criteria, requirements, null, null, sendsTelemetryEvent);
+ public Advancement(@NonNull String id, @NonNull List> requirements, boolean sendsTelemetryEvent) {
+ this(id, requirements, null, null, sendsTelemetryEvent);
}
- public Advancement(@NonNull String id, @NonNull List criteria, @NonNull List> requirements, String parentId, boolean sendsTelemetryEvent) {
- this(id, criteria, requirements, parentId, null, sendsTelemetryEvent);
+ public Advancement(@NonNull String id, @NonNull List> requirements, String parentId, boolean sendsTelemetryEvent) {
+ this(id, requirements, parentId, null, sendsTelemetryEvent);
}
- public Advancement(@NonNull String id, @NonNull List criteria, @NonNull List> requirements, DisplayData displayData, boolean sendsTelemetryEvent) {
- this(id, criteria, requirements, null, displayData, sendsTelemetryEvent);
+ public Advancement(@NonNull String id, @NonNull List> requirements, DisplayData displayData, boolean sendsTelemetryEvent) {
+ this(id, requirements, null, displayData, sendsTelemetryEvent);
}
@Data
diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/metadata/MetadataType.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/metadata/MetadataType.java
index f4c646865..60337fbc7 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/metadata/MetadataType.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/metadata/MetadataType.java
@@ -44,7 +44,7 @@ public class MetadataType {
public static final MetadataType> OPTIONAL_UUID = new MetadataType<>(optionalReader(MinecraftCodecHelper::readUUID), optionalWriter(MinecraftCodecHelper::writeUUID), ObjectEntityMetadata::new);
public static final IntMetadataType BLOCK_STATE = new IntMetadataType(MinecraftCodecHelper::readVarInt, MinecraftCodecHelper::writeVarInt, IntEntityMetadata::new);
public static final IntMetadataType OPTIONAL_BLOCK_STATE = new IntMetadataType(MinecraftCodecHelper::readVarInt, MinecraftCodecHelper::writeVarInt, IntEntityMetadata::new);
- public static final MetadataType NBT_TAG = new MetadataType<>(MinecraftCodecHelper::readTag, MinecraftCodecHelper::writeTag, ObjectEntityMetadata::new);
+ public static final MetadataType NBT_TAG = new MetadataType<>(MinecraftCodecHelper::readAnyTag, MinecraftCodecHelper::writeAnyTag, ObjectEntityMetadata::new);
public static final MetadataType PARTICLE = new MetadataType<>(MinecraftCodecHelper::readParticle, MinecraftCodecHelper::writeParticle, ObjectEntityMetadata::new);
public static final MetadataType VILLAGER_DATA = new MetadataType<>(MinecraftCodecHelper::readVillagerData, MinecraftCodecHelper::writeVillagerData, ObjectEntityMetadata::new);
public static final OptionalIntMetadataType OPTIONAL_VARINT = new OptionalIntMetadataType(ObjectEntityMetadata::new);
diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/player/PlayerSpawnInfo.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/player/PlayerSpawnInfo.java
new file mode 100644
index 000000000..3d301da1a
--- /dev/null
+++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/player/PlayerSpawnInfo.java
@@ -0,0 +1,21 @@
+package com.github.steveice10.mc.protocol.data.game.entity.player;
+
+import com.github.steveice10.mc.protocol.data.game.entity.metadata.GlobalPos;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NonNull;
+import org.jetbrains.annotations.Nullable;
+
+@Data
+@AllArgsConstructor
+public class PlayerSpawnInfo {
+ private final @NonNull String dimension;
+ private final @NonNull String worldName;
+ private final long hashedSeed;
+ private final @NonNull GameMode gameMode;
+ private final @Nullable GameMode previousGamemode;
+ private final boolean debug;
+ private final boolean flat;
+ private final @Nullable GlobalPos lastDeathPos;
+ private final int portalCooldown;
+}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/level/map/MapIconType.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/level/map/MapIconType.java
index 698d0a83f..cf60edaf3 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/data/game/level/map/MapIconType.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/level/map/MapIconType.java
@@ -27,7 +27,14 @@ public enum MapIconType {
GREEN_BANNER,
RED_BANNER,
BLACK_BANNER,
- TREASURE_MARKER;
+ TREASURE_MARKER,
+ DESERT_VILLAGE,
+ PLAINS_VILLAGE,
+ SAVANNA_VILLAGE,
+ SNOWY_VILLAGE,
+ TAIGA_VILLAGE,
+ JUNGLE_TEMPLE,
+ SWAMP_HUT;
private static final MapIconType[] VALUES = values();
diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/level/notify/GameEvent.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/level/notify/GameEvent.java
index dabdf3260..60653ad52 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/data/game/level/notify/GameEvent.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/level/notify/GameEvent.java
@@ -12,7 +12,8 @@ public enum GameEvent {
THUNDER_STRENGTH,
PUFFERFISH_STING_SOUND,
AFFECTED_BY_ELDER_GUARDIAN,
- ENABLE_RESPAWN_SCREEN;
+ ENABLE_RESPAWN_SCREEN,
+ LIMITED_CRAFTING;
private static final GameEvent[] VALUES = values();
diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/level/notify/LimitedCraftingValue.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/level/notify/LimitedCraftingValue.java
new file mode 100644
index 000000000..e706873a7
--- /dev/null
+++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/level/notify/LimitedCraftingValue.java
@@ -0,0 +1,12 @@
+package com.github.steveice10.mc.protocol.data.game.level.notify;
+
+public enum LimitedCraftingValue implements GameEventValue {
+ UNLIMITED_CRAFTING,
+ LIMITED_CRAFTING;
+
+ private static final LimitedCraftingValue[] VALUES = values();
+
+ public static LimitedCraftingValue from(int id) {
+ return VALUES[id];
+ }
+}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/level/sound/BuiltinSound.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/level/sound/BuiltinSound.java
index c24952164..9c8846e9c 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/data/game/level/sound/BuiltinSound.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/level/sound/BuiltinSound.java
@@ -1265,6 +1265,12 @@ public enum BuiltinSound implements Sound {
ENTITY_SPIDER_STEP("entity.spider.step"),
ENTITY_SPLASH_POTION_BREAK("entity.splash_potion.break"),
ENTITY_SPLASH_POTION_THROW("entity.splash_potion.throw"),
+ BLOCK_SPONGE_BREAK("block.sponge.break"),
+ BLOCK_SPONGE_FALL("block.sponge.fall"),
+ BLOCK_SPONGE_HIT("block.sponge.hit"),
+ BLOCK_SPONGE_PLACE("block.sponge.place"),
+ BLOCK_SPONGE_STEP("block.sponge.step"),
+ BLOCK_SPONGE_ABSORB("block.sponge.absorb"),
ITEM_SPYGLASS_USE("item.spyglass.use"),
ITEM_SPYGLASS_STOP_USING("item.spyglass.stop_using"),
ENTITY_SQUID_AMBIENT("entity.squid.ambient"),
@@ -1409,6 +1415,11 @@ public enum BuiltinSound implements Sound {
BLOCK_WET_GRASS_HIT("block.wet_grass.hit"),
BLOCK_WET_GRASS_PLACE("block.wet_grass.place"),
BLOCK_WET_GRASS_STEP("block.wet_grass.step"),
+ BLOCK_WET_SPONGE_BREAK("block.wet_sponge.break"),
+ BLOCK_WET_SPONGE_FALL("block.wet_sponge.fall"),
+ BLOCK_WET_SPONGE_HIT("block.wet_sponge.hit"),
+ BLOCK_WET_SPONGE_PLACE("block.wet_sponge.place"),
+ BLOCK_WET_SPONGE_STEP("block.wet_sponge.step"),
ENTITY_WITCH_AMBIENT("entity.witch.ambient"),
ENTITY_WITCH_CELEBRATE("entity.witch.celebrate"),
ENTITY_WITCH_DEATH("entity.witch.death"),
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundCustomPayloadPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundCustomPayloadPacket.java
similarity index 93%
rename from src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundCustomPayloadPacket.java
rename to src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundCustomPayloadPacket.java
index 0df956b81..115172e00 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundCustomPayloadPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundCustomPayloadPacket.java
@@ -1,4 +1,4 @@
-package com.github.steveice10.mc.protocol.packet.ingame.clientbound;
+package com.github.steveice10.mc.protocol.packet.common.clientbound;
import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundDisconnectPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundDisconnectPacket.java
similarity index 94%
rename from src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundDisconnectPacket.java
rename to src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundDisconnectPacket.java
index c0366df5d..6e0fb388b 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundDisconnectPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundDisconnectPacket.java
@@ -1,4 +1,4 @@
-package com.github.steveice10.mc.protocol.packet.ingame.clientbound;
+package com.github.steveice10.mc.protocol.packet.common.clientbound;
import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundKeepAlivePacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundKeepAlivePacket.java
similarity index 91%
rename from src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundKeepAlivePacket.java
rename to src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundKeepAlivePacket.java
index a31fffb00..1aac03339 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundKeepAlivePacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundKeepAlivePacket.java
@@ -1,4 +1,4 @@
-package com.github.steveice10.mc.protocol.packet.ingame.clientbound;
+package com.github.steveice10.mc.protocol.packet.common.clientbound;
import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundPingPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundPingPacket.java
similarity index 91%
rename from src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundPingPacket.java
rename to src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundPingPacket.java
index d8c60e034..fba16f5ae 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundPingPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundPingPacket.java
@@ -1,4 +1,4 @@
-package com.github.steveice10.mc.protocol.packet.ingame.clientbound;
+package com.github.steveice10.mc.protocol.packet.common.clientbound;
import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundResourcePackPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundResourcePackPacket.java
similarity index 95%
rename from src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundResourcePackPacket.java
rename to src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundResourcePackPacket.java
index 5f59073ff..2ae7cbb96 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundResourcePackPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundResourcePackPacket.java
@@ -1,4 +1,4 @@
-package com.github.steveice10.mc.protocol.packet.ingame.clientbound;
+package com.github.steveice10.mc.protocol.packet.common.clientbound;
import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundUpdateTagsPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundUpdateTagsPacket.java
similarity index 92%
rename from src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundUpdateTagsPacket.java
rename to src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundUpdateTagsPacket.java
index 050cd7fea..41116ba8d 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundUpdateTagsPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/common/clientbound/ClientboundUpdateTagsPacket.java
@@ -1,15 +1,13 @@
-package com.github.steveice10.mc.protocol.packet.ingame.clientbound;
+package com.github.steveice10.mc.protocol.packet.common.clientbound;
import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
-import com.github.steveice10.mc.protocol.data.game.Identifier;
import io.netty.buffer.ByteBuf;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NonNull;
import lombok.With;
-import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundClientInformationPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/common/serverbound/ServerboundClientInformationPacket.java
similarity index 97%
rename from src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundClientInformationPacket.java
rename to src/main/java/com/github/steveice10/mc/protocol/packet/common/serverbound/ServerboundClientInformationPacket.java
index aef313e0c..3255fd7cb 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundClientInformationPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/common/serverbound/ServerboundClientInformationPacket.java
@@ -1,4 +1,4 @@
-package com.github.steveice10.mc.protocol.packet.ingame.serverbound;
+package com.github.steveice10.mc.protocol.packet.common.serverbound;
import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundCustomPayloadPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/common/serverbound/ServerboundCustomPayloadPacket.java
similarity index 93%
rename from src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundCustomPayloadPacket.java
rename to src/main/java/com/github/steveice10/mc/protocol/packet/common/serverbound/ServerboundCustomPayloadPacket.java
index e7c7fe21d..aa8a7c9f8 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundCustomPayloadPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/common/serverbound/ServerboundCustomPayloadPacket.java
@@ -1,4 +1,4 @@
-package com.github.steveice10.mc.protocol.packet.ingame.serverbound;
+package com.github.steveice10.mc.protocol.packet.common.serverbound;
import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundKeepAlivePacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/common/serverbound/ServerboundKeepAlivePacket.java
similarity index 91%
rename from src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundKeepAlivePacket.java
rename to src/main/java/com/github/steveice10/mc/protocol/packet/common/serverbound/ServerboundKeepAlivePacket.java
index d4259cb9b..a73dd6e56 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundKeepAlivePacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/common/serverbound/ServerboundKeepAlivePacket.java
@@ -1,4 +1,4 @@
-package com.github.steveice10.mc.protocol.packet.ingame.serverbound;
+package com.github.steveice10.mc.protocol.packet.common.serverbound;
import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundPongPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/common/serverbound/ServerboundPongPacket.java
similarity index 91%
rename from src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundPongPacket.java
rename to src/main/java/com/github/steveice10/mc/protocol/packet/common/serverbound/ServerboundPongPacket.java
index 8ca9cb87c..e81923e4f 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundPongPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/common/serverbound/ServerboundPongPacket.java
@@ -1,4 +1,4 @@
-package com.github.steveice10.mc.protocol.packet.ingame.serverbound;
+package com.github.steveice10.mc.protocol.packet.common.serverbound;
import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundResourcePackPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/common/serverbound/ServerboundResourcePackPacket.java
similarity index 93%
rename from src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundResourcePackPacket.java
rename to src/main/java/com/github/steveice10/mc/protocol/packet/common/serverbound/ServerboundResourcePackPacket.java
index 07341b8e7..563ed0087 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundResourcePackPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/common/serverbound/ServerboundResourcePackPacket.java
@@ -1,4 +1,4 @@
-package com.github.steveice10.mc.protocol.packet.ingame.serverbound;
+package com.github.steveice10.mc.protocol.packet.common.serverbound;
import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/configuration/clientbound/ClientboundFinishConfigurationPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/configuration/clientbound/ClientboundFinishConfigurationPacket.java
new file mode 100644
index 000000000..14c7e3c22
--- /dev/null
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/configuration/clientbound/ClientboundFinishConfigurationPacket.java
@@ -0,0 +1,18 @@
+package com.github.steveice10.mc.protocol.packet.configuration.clientbound;
+
+import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
+import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
+import io.netty.buffer.ByteBuf;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+public class ClientboundFinishConfigurationPacket implements MinecraftPacket {
+ public ClientboundFinishConfigurationPacket(ByteBuf in, MinecraftCodecHelper helper) {
+ }
+
+ @Override
+ public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
+ }
+}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/configuration/clientbound/ClientboundRegistryDataPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/configuration/clientbound/ClientboundRegistryDataPacket.java
new file mode 100644
index 000000000..79ac9877f
--- /dev/null
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/configuration/clientbound/ClientboundRegistryDataPacket.java
@@ -0,0 +1,27 @@
+package com.github.steveice10.mc.protocol.packet.configuration.clientbound;
+
+import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
+import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
+import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
+import io.netty.buffer.ByteBuf;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.With;
+
+import java.io.IOException;
+
+@Data
+@With
+@AllArgsConstructor
+public class ClientboundRegistryDataPacket implements MinecraftPacket {
+ private final CompoundTag registry;
+
+ public ClientboundRegistryDataPacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
+ this.registry = helper.readAnyTag(in);
+ }
+
+ @Override
+ public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
+ helper.writeAnyTag(out, this.registry);
+ }
+}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundUpdateEnabledFeaturesPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/configuration/clientbound/ClientboundUpdateEnabledFeaturesPacket.java
similarity index 92%
rename from src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundUpdateEnabledFeaturesPacket.java
rename to src/main/java/com/github/steveice10/mc/protocol/packet/configuration/clientbound/ClientboundUpdateEnabledFeaturesPacket.java
index 1aaccc4a0..6b22e834f 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundUpdateEnabledFeaturesPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/configuration/clientbound/ClientboundUpdateEnabledFeaturesPacket.java
@@ -1,4 +1,4 @@
-package com.github.steveice10.mc.protocol.packet.ingame.clientbound;
+package com.github.steveice10.mc.protocol.packet.configuration.clientbound;
import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/configuration/serverbound/ServerboundFinishConfigurationPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/configuration/serverbound/ServerboundFinishConfigurationPacket.java
new file mode 100644
index 000000000..4385dde61
--- /dev/null
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/configuration/serverbound/ServerboundFinishConfigurationPacket.java
@@ -0,0 +1,18 @@
+package com.github.steveice10.mc.protocol.packet.configuration.serverbound;
+
+import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
+import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
+import io.netty.buffer.ByteBuf;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+public class ServerboundFinishConfigurationPacket implements MinecraftPacket {
+
+ public ServerboundFinishConfigurationPacket(ByteBuf in, MinecraftCodecHelper helper) {
+ }
+
+ public void serialize(ByteBuf buf, MinecraftCodecHelper helper) {
+ }
+}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundLoginPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundLoginPacket.java
index 7005008fc..e3d05bc84 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundLoginPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundLoginPacket.java
@@ -4,6 +4,7 @@
import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.GlobalPos;
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.opennbt.tag.builtin.CompoundTag;
import io.netty.buffer.ByteBuf;
import lombok.AllArgsConstructor;
@@ -20,77 +21,46 @@
public class ClientboundLoginPacket implements MinecraftPacket {
private final int entityId;
private final boolean hardcore;
- private final @NonNull GameMode gameMode;
- private final @Nullable GameMode previousGamemode;
private final @NonNull String[] worldNames;
- private final @NonNull CompoundTag registry;
- private final @NonNull String dimension;
- private final @NonNull String worldName;
- private final long hashedSeed;
private final int maxPlayers;
private final int viewDistance;
private final int simulationDistance;
private final boolean reducedDebugInfo;
private final boolean enableRespawnScreen;
- private final boolean debug;
- private final boolean flat;
- private final @Nullable GlobalPos lastDeathPos;
- private final int portalCooldown;
+ private final boolean doLimitedCrafting;
+ private final PlayerSpawnInfo commonPlayerSpawnInfo;
public ClientboundLoginPacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
this.entityId = in.readInt();
this.hardcore = in.readBoolean();
- this.gameMode = GameMode.byId(in.readByte());
- this.previousGamemode = GameMode.byNullableId(in.readByte());
int worldCount = helper.readVarInt(in);
this.worldNames = new String[worldCount];
for (int i = 0; i < worldCount; i++) {
this.worldNames[i] = helper.readString(in);
}
- this.registry = helper.readTag(in);
- this.dimension = helper.readString(in);
- this.worldName = helper.readString(in);
- this.hashedSeed = in.readLong();
this.maxPlayers = helper.readVarInt(in);
this.viewDistance = helper.readVarInt(in);
this.simulationDistance = helper.readVarInt(in);
this.reducedDebugInfo = in.readBoolean();
this.enableRespawnScreen = in.readBoolean();
- this.debug = in.readBoolean();
- this.flat = in.readBoolean();
- if (in.readBoolean()) {
- this.lastDeathPos = helper.readGlobalPos(in);
- } else {
- this.lastDeathPos = null;
- }
- this.portalCooldown = helper.readVarInt(in);
+ this.doLimitedCrafting = in.readBoolean();
+ this.commonPlayerSpawnInfo = helper.readPlayerSpawnInfo(in);
}
@Override
public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
out.writeInt(this.entityId);
out.writeBoolean(this.hardcore);
- out.writeByte(this.gameMode.ordinal());
- out.writeByte(GameMode.toNullableId(this.previousGamemode));
helper.writeVarInt(out, this.worldNames.length);
for (String worldName : this.worldNames) {
helper.writeString(out, worldName);
}
- helper.writeTag(out, this.registry);
- helper.writeString(out, this.dimension);
- helper.writeString(out, this.worldName);
- out.writeLong(this.hashedSeed);
helper.writeVarInt(out, this.maxPlayers);
helper.writeVarInt(out, this.viewDistance);
helper.writeVarInt(out, this.simulationDistance);
out.writeBoolean(this.reducedDebugInfo);
out.writeBoolean(this.enableRespawnScreen);
- out.writeBoolean(this.debug);
- out.writeBoolean(this.flat);
- out.writeBoolean(this.lastDeathPos != null);
- if (this.lastDeathPos != null) {
- helper.writeGlobalPos(out, this.lastDeathPos);
- }
- helper.writeVarInt(out, this.portalCooldown);
+ out.writeBoolean(this.doLimitedCrafting);
+ helper.writePlayerSpawnInfo(out, this.commonPlayerSpawnInfo);
}
}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundPlayerInfoUpdatePacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundPlayerInfoUpdatePacket.java
index 5a32d2a60..526f09cc6 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundPlayerInfoUpdatePacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundPlayerInfoUpdatePacket.java
@@ -37,7 +37,7 @@ public ClientboundPlayerInfoUpdatePacket(ByteBuf in, MinecraftCodecHelper helper
for (PlayerListEntryAction action : this.actions) {
switch (action) {
case ADD_PLAYER: {
- GameProfile profile = new GameProfile(entry.getProfile().getId(), helper.readString(in, 16));
+ GameProfile profile = new GameProfile(entry.getProfileId(), helper.readString(in, 16));
int propertyCount = helper.readVarInt(in);
List propertyList = new ArrayList<>();
for (int index = 0; index < propertyCount; index++) {
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundRespawnPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundRespawnPacket.java
index 459553575..7278b9db3 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundRespawnPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundRespawnPacket.java
@@ -4,6 +4,7 @@
import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.GlobalPos;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
+import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerSpawnInfo;
import io.netty.buffer.ByteBuf;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -18,43 +19,21 @@ public class ClientboundRespawnPacket implements MinecraftPacket {
private static final byte KEEP_ATTRIBUTES = 1;
private static final byte KEEP_ENTITY_DATA = 2;
- private final @NonNull String dimension;
- private final @NonNull String worldName;
- private final long hashedSeed;
- private final @NonNull GameMode gamemode;
- private final @Nullable GameMode previousGamemode;
- private final boolean debug;
- private final boolean flat;
+ private final PlayerSpawnInfo commonPlayerSpawnInfo;
// The following two are the dataToKeep byte
private final boolean keepMetadata;
private final boolean keepAttributes;
- private final @Nullable GlobalPos lastDeathPos;
- private final int portalCooldown;
public ClientboundRespawnPacket(ByteBuf in, MinecraftCodecHelper helper) {
- this.dimension = helper.readString(in);
- this.worldName = helper.readString(in);
- this.hashedSeed = in.readLong();
- this.gamemode = GameMode.byId(in.readUnsignedByte()); // Intentionally unsigned as of 1.19.3
- this.previousGamemode = GameMode.byNullableId(in.readByte());
- this.debug = in.readBoolean();
- this.flat = in.readBoolean();
+ this.commonPlayerSpawnInfo = helper.readPlayerSpawnInfo(in);
byte dataToKeep = in.readByte();
this.keepAttributes = (dataToKeep & KEEP_ATTRIBUTES) != 0;
this.keepMetadata = (dataToKeep & KEEP_ENTITY_DATA) != 0;
- this.lastDeathPos = helper.readNullable(in, helper::readGlobalPos);
- this.portalCooldown = helper.readVarInt(in);
}
@Override
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
- helper.writeString(out, this.dimension);
- helper.writeString(out, this.worldName);
- out.writeLong(this.hashedSeed);
- out.writeByte(this.gamemode.ordinal());
- out.writeByte(GameMode.toNullableId(this.previousGamemode));
- out.writeBoolean(this.debug);
- out.writeBoolean(this.flat);
+ helper.writePlayerSpawnInfo(out, this.commonPlayerSpawnInfo);
byte dataToKeep = 0;
if (this.keepMetadata) {
dataToKeep += KEEP_ENTITY_DATA;
@@ -63,7 +42,5 @@ public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
dataToKeep += KEEP_ATTRIBUTES;
}
out.writeByte(dataToKeep);
- helper.writeNullable(out, this.lastDeathPos, helper::writeGlobalPos);
- helper.writeVarInt(out, this.portalCooldown);
}
}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundStartConfigurationPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundStartConfigurationPacket.java
new file mode 100644
index 000000000..81b251a54
--- /dev/null
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundStartConfigurationPacket.java
@@ -0,0 +1,20 @@
+package com.github.steveice10.mc.protocol.packet.ingame.clientbound;
+
+import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
+import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
+import io.netty.buffer.ByteBuf;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.IOException;
+
+@Data
+@NoArgsConstructor
+public class ClientboundStartConfigurationPacket implements MinecraftPacket {
+
+ public ClientboundStartConfigurationPacket(ByteBuf in, MinecraftCodecHelper helper) {
+ }
+
+ public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
+ }
+}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundUpdateAdvancementsPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundUpdateAdvancementsPacket.java
index bc4883eba..4a4383b22 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundUpdateAdvancementsPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundUpdateAdvancementsPacket.java
@@ -52,7 +52,7 @@ public ClientboundUpdateAdvancementsPacket(ByteBuf in, MinecraftCodecHelper help
this.advancements = new Advancement[helper.readVarInt(in)];
for (int i = 0; i < this.advancements.length; i++) {
String id = helper.readString(in);
- String parentId = in.readBoolean() ? helper.readString(in) : null;
+ String parentId = helper.readNullable(in, helper::readString);
DisplayData displayData = null;
if (in.readBoolean()) {
Component title = helper.readComponent(in);
@@ -72,12 +72,6 @@ public ClientboundUpdateAdvancementsPacket(ByteBuf in, MinecraftCodecHelper help
displayData = new DisplayData(title, description, icon, frameType, showToast, hidden, posX, posY, backgroundTexture);
}
- List criteria = new ArrayList<>();
- int criteriaCount = helper.readVarInt(in);
- for (int j = 0; j < criteriaCount; j++) {
- criteria.add(helper.readString(in));
- }
-
List> requirements = new ArrayList<>();
int requirementCount = helper.readVarInt(in);
for (int j = 0; j < requirementCount; j++) {
@@ -92,7 +86,7 @@ public ClientboundUpdateAdvancementsPacket(ByteBuf in, MinecraftCodecHelper help
boolean sendTelemetryEvent = in.readBoolean();
- this.advancements[i] = new Advancement(id, criteria, requirements, parentId, displayData, sendTelemetryEvent);
+ this.advancements[i] = new Advancement(id, requirements, parentId, displayData, sendTelemetryEvent);
}
this.removedAdvancements = new String[helper.readVarInt(in)];
@@ -165,11 +159,6 @@ public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOExcepti
out.writeBoolean(false);
}
- helper.writeVarInt(out, advancement.getCriteria().size());
- for (String criterion : advancement.getCriteria()) {
- helper.writeString(out, criterion);
- }
-
helper.writeVarInt(out, advancement.getRequirements().size());
for (List requirement : advancement.getRequirements()) {
helper.writeVarInt(out, requirement.size());
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/entity/spawn/ClientboundAddPlayerPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/entity/spawn/ClientboundAddPlayerPacket.java
deleted file mode 100644
index 012f64a49..000000000
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/entity/spawn/ClientboundAddPlayerPacket.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn;
-
-import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
-import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
-import io.netty.buffer.ByteBuf;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NonNull;
-import lombok.With;
-
-import java.io.IOException;
-import java.util.UUID;
-
-@Data
-@With
-@AllArgsConstructor
-public class ClientboundAddPlayerPacket implements MinecraftPacket {
- private final int entityId;
- private final @NonNull UUID uuid;
- private final double x;
- private final double y;
- private final double z;
- private final float yaw;
- private final float pitch;
-
- public ClientboundAddPlayerPacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
- this.entityId = helper.readVarInt(in);
- this.uuid = helper.readUUID(in);
- this.x = in.readDouble();
- this.y = in.readDouble();
- this.z = in.readDouble();
- this.yaw = in.readByte() * 360 / 256f;
- this.pitch = in.readByte() * 360 / 256f;
- }
-
- @Override
- public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
- helper.writeVarInt(out, this.entityId);
- helper.writeUUID(out, this.uuid);
- out.writeDouble(this.x);
- out.writeDouble(this.y);
- out.writeDouble(this.z);
- out.writeByte((byte) (this.yaw * 256 / 360));
- out.writeByte((byte) (this.pitch * 256 / 360));
- }
-}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundBlockEntityDataPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundBlockEntityDataPacket.java
index 507b6196a..84fd24902 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundBlockEntityDataPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundBlockEntityDataPacket.java
@@ -25,13 +25,13 @@ public class ClientboundBlockEntityDataPacket implements MinecraftPacket {
public ClientboundBlockEntityDataPacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
this.position = helper.readPosition(in);
this.type = helper.readBlockEntityType(in);
- this.nbt = helper.readTag(in);
+ this.nbt = helper.readAnyTag(in);
}
@Override
public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
helper.writePosition(out, this.position);
helper.writeBlockEntityType(out, this.type);
- helper.writeTag(out, this.nbt);
+ helper.writeAnyTag(out, this.nbt);
}
}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundChunkBatchFinishedPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundChunkBatchFinishedPacket.java
new file mode 100644
index 000000000..49d173c7b
--- /dev/null
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundChunkBatchFinishedPacket.java
@@ -0,0 +1,25 @@
+package com.github.steveice10.mc.protocol.packet.ingame.clientbound.level;
+
+import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
+import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
+import io.netty.buffer.ByteBuf;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.With;
+
+import java.io.IOException;
+
+@Data
+@With
+@AllArgsConstructor
+public class ClientboundChunkBatchFinishedPacket implements MinecraftPacket {
+ private final int batchSize;
+
+ public ClientboundChunkBatchFinishedPacket(ByteBuf in, MinecraftCodecHelper helper) {
+ this.batchSize = helper.readVarInt(in);
+ }
+
+ public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
+ helper.writeVarInt(out, this.batchSize);
+ }
+}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundChunkBatchStartPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundChunkBatchStartPacket.java
new file mode 100644
index 000000000..24f525847
--- /dev/null
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundChunkBatchStartPacket.java
@@ -0,0 +1,20 @@
+package com.github.steveice10.mc.protocol.packet.ingame.clientbound.level;
+
+import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
+import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
+import io.netty.buffer.ByteBuf;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.IOException;
+
+@Data
+@NoArgsConstructor
+public class ClientboundChunkBatchStartPacket implements MinecraftPacket {
+
+ public ClientboundChunkBatchStartPacket(ByteBuf in, MinecraftCodecHelper helper) {
+ }
+
+ public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
+ }
+}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundForgetLevelChunkPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundForgetLevelChunkPacket.java
index cd54bc1d4..ec0df69be 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundForgetLevelChunkPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundForgetLevelChunkPacket.java
@@ -17,13 +17,13 @@ public class ClientboundForgetLevelChunkPacket implements MinecraftPacket {
private final int z;
public ClientboundForgetLevelChunkPacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
- this.x = in.readInt();
- this.z = in.readInt();
+ long chunkPosition = in.readLong();
+ this.x = (int)chunkPosition;
+ this.z = (int)(chunkPosition >> 32);
}
@Override
public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
- out.writeInt(this.x);
- out.writeInt(this.z);
+ out.writeLong(this.x & 0xFFFFFFFFL | (this.z & 0xFFFFFFFFL) << 32);
}
}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundGameEventPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundGameEventPacket.java
index abb059b82..350014424 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundGameEventPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundGameEventPacket.java
@@ -31,6 +31,8 @@ public ClientboundGameEventPacket(ByteBuf in, MinecraftCodecHelper helper) {
this.value = EnterCreditsValue.from((int) value);
} else if (this.notification == GameEvent.ENABLE_RESPAWN_SCREEN) {
this.value = RespawnScreenValue.from((int) value);
+ } else if (this.notification == GameEvent.LIMITED_CRAFTING) {
+ this.value = LimitedCraftingValue.from((int) value);
} else if (this.notification == GameEvent.RAIN_STRENGTH) {
this.value = new RainStrengthValue(value);
} else if (this.notification == GameEvent.THUNDER_STRENGTH) {
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundLevelChunkWithLightPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundLevelChunkWithLightPacket.java
index c1c808e58..00962f7d7 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundLevelChunkWithLightPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundLevelChunkWithLightPacket.java
@@ -28,7 +28,7 @@ public class ClientboundLevelChunkWithLightPacket implements MinecraftPacket {
public ClientboundLevelChunkWithLightPacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
this.x = in.readInt();
this.z = in.readInt();
- this.heightMaps = helper.readTag(in);
+ this.heightMaps = helper.readAnyTag(in);
this.chunkData = helper.readByteArray(in);
this.blockEntities = new BlockEntityInfo[helper.readVarInt(in)];
@@ -38,7 +38,7 @@ public ClientboundLevelChunkWithLightPacket(ByteBuf in, MinecraftCodecHelper hel
int blockEntityZ = xz & 15;
int blockEntityY = in.readShort();
BlockEntityType type = helper.readBlockEntityType(in);
- CompoundTag tag = helper.readTag(in);
+ CompoundTag tag = helper.readAnyTag(in);
this.blockEntities[i] = new BlockEntityInfo(blockEntityX, blockEntityY, blockEntityZ, type, tag);
}
@@ -49,7 +49,7 @@ public ClientboundLevelChunkWithLightPacket(ByteBuf in, MinecraftCodecHelper hel
public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
out.writeInt(this.x);
out.writeInt(this.z);
- helper.writeTag(out, this.heightMaps);
+ helper.writeAnyTag(out, this.heightMaps);
helper.writeVarInt(out, this.chunkData.length);
out.writeBytes(this.chunkData);
@@ -58,7 +58,7 @@ public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOExcepti
out.writeByte(((blockEntity.getX() & 15) << 4) | blockEntity.getZ() & 15);
out.writeShort(blockEntity.getY());
helper.writeBlockEntityType(out, blockEntity.getType());
- helper.writeTag(out, blockEntity.getNbt());
+ helper.writeAnyTag(out, blockEntity.getNbt());
}
helper.writeLightUpdateData(out, this.lightData);
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundTagQueryPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundTagQueryPacket.java
index 9908dcfa8..e2c866f5c 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundTagQueryPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundTagQueryPacket.java
@@ -20,12 +20,12 @@ public class ClientboundTagQueryPacket implements MinecraftPacket {
public ClientboundTagQueryPacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
this.transactionId = helper.readVarInt(in);
- this.nbt = helper.readTag(in);
+ this.nbt = helper.readAnyTag(in);
}
@Override
public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
helper.writeVarInt(out, this.transactionId);
- helper.writeTag(out, this.nbt);
+ helper.writeAnyTag(out, this.nbt);
}
}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/scoreboard/ClientboundSetDisplayObjectivePacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/scoreboard/ClientboundSetDisplayObjectivePacket.java
index 3311a8732..037b01ad6 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/scoreboard/ClientboundSetDisplayObjectivePacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/scoreboard/ClientboundSetDisplayObjectivePacket.java
@@ -19,13 +19,13 @@ public class ClientboundSetDisplayObjectivePacket implements MinecraftPacket {
private final @NonNull String name;
public ClientboundSetDisplayObjectivePacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
- this.position = ScoreboardPosition.from(in.readByte());
+ this.position = ScoreboardPosition.from(helper.readVarInt(in));
this.name = helper.readString(in);
}
@Override
public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
- out.writeByte(this.position.ordinal());
+ helper.writeVarInt(out, this.position.ordinal());
helper.writeString(out, this.name);
}
}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundConfigurationAcknowledgedPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundConfigurationAcknowledgedPacket.java
new file mode 100644
index 000000000..85b2815fb
--- /dev/null
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/ServerboundConfigurationAcknowledgedPacket.java
@@ -0,0 +1,20 @@
+package com.github.steveice10.mc.protocol.packet.ingame.serverbound;
+
+import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
+import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
+import io.netty.buffer.ByteBuf;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.IOException;
+
+@Data
+@NoArgsConstructor
+public class ServerboundConfigurationAcknowledgedPacket implements MinecraftPacket {
+
+ public ServerboundConfigurationAcknowledgedPacket(ByteBuf in, MinecraftCodecHelper helper) {
+ }
+
+ public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
+ }
+}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/level/ServerboundChunkBatchReceivedPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/level/ServerboundChunkBatchReceivedPacket.java
new file mode 100644
index 000000000..66dbbf102
--- /dev/null
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/serverbound/level/ServerboundChunkBatchReceivedPacket.java
@@ -0,0 +1,23 @@
+package com.github.steveice10.mc.protocol.packet.ingame.serverbound.level;
+
+import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
+import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
+import io.netty.buffer.ByteBuf;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.With;
+
+@Data
+@With
+@AllArgsConstructor
+public class ServerboundChunkBatchReceivedPacket implements MinecraftPacket {
+ private final float desiredChunksPerTick;
+
+ public ServerboundChunkBatchReceivedPacket(ByteBuf in, MinecraftCodecHelper helper) {
+ this.desiredChunksPerTick = in.readFloat();
+ }
+
+ public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
+ out.writeFloat(this.desiredChunksPerTick);
+ }
+}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundCustomQueryAnswerPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundCustomQueryAnswerPacket.java
new file mode 100644
index 000000000..ea9dd8540
--- /dev/null
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundCustomQueryAnswerPacket.java
@@ -0,0 +1,31 @@
+package com.github.steveice10.mc.protocol.packet.login.serverbound;
+
+import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
+import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
+import io.netty.buffer.ByteBuf;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.With;
+
+@Data
+@With
+@AllArgsConstructor
+public class ServerboundCustomQueryAnswerPacket implements MinecraftPacket {
+ private final int transactionId;
+ private final byte[] data;
+
+ public ServerboundCustomQueryAnswerPacket(int transactionId) {
+ this(transactionId, new byte[0]);
+ }
+
+ public ServerboundCustomQueryAnswerPacket(ByteBuf in, MinecraftCodecHelper helper) {
+ this.transactionId = helper.readVarInt(in);
+ this.data = helper.readByteArray(in, ByteBuf::readableBytes);
+ }
+
+ @Override
+ public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
+ helper.writeVarInt(out, this.transactionId);
+ out.writeBytes(this.data);
+ }
+}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundCustomQueryPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundCustomQueryPacket.java
deleted file mode 100644
index ba1625ce7..000000000
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundCustomQueryPacket.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.github.steveice10.mc.protocol.packet.login.serverbound;
-
-import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
-import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
-import io.netty.buffer.ByteBuf;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.With;
-
-import java.io.IOException;
-
-@Data
-@With
-@AllArgsConstructor
-public class ServerboundCustomQueryPacket implements MinecraftPacket {
- private final int messageId;
- private final byte[] data;
-
- public ServerboundCustomQueryPacket(int messageId) {
- this(messageId, null);
- }
-
- public ServerboundCustomQueryPacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
- this.messageId = helper.readVarInt(in);
- if (in.readBoolean()) {
- this.data = helper.readByteArray(in, ByteBuf::readableBytes);
- } else {
- this.data = null;
- }
- }
-
- @Override
- public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
- helper.writeVarInt(out, this.messageId);
- if (this.data != null) {
- out.writeBoolean(true);
- out.writeBytes(this.data);
- } else {
- out.writeBoolean(false);
- }
- }
-}
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundHelloPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundHelloPacket.java
index b711ddc4e..75a1c6e56 100644
--- a/src/main/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundHelloPacket.java
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundHelloPacket.java
@@ -7,15 +7,8 @@
import lombok.Data;
import lombok.NonNull;
import lombok.With;
-import org.jetbrains.annotations.Contract;
-import org.jetbrains.annotations.Nullable;
import java.io.IOException;
-import java.security.GeneralSecurityException;
-import java.security.KeyFactory;
-import java.security.PublicKey;
-import java.security.spec.X509EncodedKeySpec;
-import java.time.Instant;
import java.util.UUID;
@Data
@@ -23,17 +16,17 @@
@AllArgsConstructor
public class ServerboundHelloPacket implements MinecraftPacket {
private final @NonNull String username;
- private final @Nullable UUID profileId;
+ private final @NonNull UUID profileId;
public ServerboundHelloPacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
this.username = helper.readString(in);
- this.profileId = helper.readNullable(in, helper::readUUID);
+ this.profileId = helper.readUUID(in);
}
@Override
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
helper.writeString(out, this.username);
- helper.writeNullable(out, this.profileId, helper::writeUUID);
+ helper.writeUUID(out, this.profileId);
}
@Override
diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundLoginAcknowledgedPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundLoginAcknowledgedPacket.java
new file mode 100644
index 000000000..397aa1c88
--- /dev/null
+++ b/src/main/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundLoginAcknowledgedPacket.java
@@ -0,0 +1,18 @@
+package com.github.steveice10.mc.protocol.packet.login.serverbound;
+
+import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
+import com.github.steveice10.mc.protocol.codec.MinecraftPacket;
+import io.netty.buffer.ByteBuf;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+public class ServerboundLoginAcknowledgedPacket implements MinecraftPacket {
+ public ServerboundLoginAcknowledgedPacket(ByteBuf in, MinecraftCodecHelper helper) {
+ }
+
+ @Override
+ public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
+ }
+}
diff --git a/src/main/java/com/github/steveice10/packetlib/tcp/TcpPacketCompression.java b/src/main/java/com/github/steveice10/packetlib/tcp/TcpPacketCompression.java
index 4d2c2bf49..57e55bec4 100644
--- a/src/main/java/com/github/steveice10/packetlib/tcp/TcpPacketCompression.java
+++ b/src/main/java/com/github/steveice10/packetlib/tcp/TcpPacketCompression.java
@@ -1,7 +1,6 @@
package com.github.steveice10.packetlib.tcp;
import com.github.steveice10.packetlib.Session;
-import com.github.steveice10.packetlib.codec.PacketCodecHelper;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
@@ -13,7 +12,7 @@
import java.util.zip.Inflater;
public class TcpPacketCompression extends ByteToMessageCodec {
- private static final int MAX_COMPRESSED_SIZE = 2097152;
+ private static final int MAX_UNCOMPRESSED_SIZE = 8388608;
private final Session session;
private final Deflater deflater = new Deflater();
@@ -57,9 +56,9 @@ public void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Ex
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf buf, List