Bump protocol & add more illegal/ignored packets

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
This commit is contained in:
Joshua Castle 2024-04-20 17:05:12 -07:00
parent 2b5afa16ba
commit 319beb3cd4
No known key found for this signature in database
GPG key ID: 7ECA1A2FC38ABA9F
2 changed files with 112 additions and 56 deletions

View file

@ -34,32 +34,59 @@ import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper;
import org.cloudburstmc.protocol.bedrock.codec.BedrockPacketSerializer; import org.cloudburstmc.protocol.bedrock.codec.BedrockPacketSerializer;
import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.MobArmorEquipmentSerializer_v291; import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.MobArmorEquipmentSerializer_v291;
import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.MobEquipmentSerializer_v291; import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.MobEquipmentSerializer_v291;
import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.PlayerHotbarSerializer_v291;
import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.SetEntityLinkSerializer_v291;
import org.cloudburstmc.protocol.bedrock.codec.v390.serializer.PlayerSkinSerializer_v390;
import org.cloudburstmc.protocol.bedrock.codec.v407.serializer.InventoryContentSerializer_v407; import org.cloudburstmc.protocol.bedrock.codec.v407.serializer.InventoryContentSerializer_v407;
import org.cloudburstmc.protocol.bedrock.codec.v407.serializer.InventorySlotSerializer_v407; import org.cloudburstmc.protocol.bedrock.codec.v407.serializer.InventorySlotSerializer_v407;
import org.cloudburstmc.protocol.bedrock.codec.v486.serializer.BossEventSerializer_v486; import org.cloudburstmc.protocol.bedrock.codec.v486.serializer.BossEventSerializer_v486;
import org.cloudburstmc.protocol.bedrock.codec.v557.serializer.SetEntityDataSerializer_v557;
import org.cloudburstmc.protocol.bedrock.codec.v622.Bedrock_v622; import org.cloudburstmc.protocol.bedrock.codec.v622.Bedrock_v622;
import org.cloudburstmc.protocol.bedrock.codec.v630.Bedrock_v630; import org.cloudburstmc.protocol.bedrock.codec.v630.Bedrock_v630;
import org.cloudburstmc.protocol.bedrock.codec.v649.Bedrock_v649; import org.cloudburstmc.protocol.bedrock.codec.v649.Bedrock_v649;
import org.cloudburstmc.protocol.bedrock.codec.v662.Bedrock_v662; import org.cloudburstmc.protocol.bedrock.codec.v662.Bedrock_v662;
import org.cloudburstmc.protocol.bedrock.codec.v662.serializer.SetEntityMotionSerializer_v662;
import org.cloudburstmc.protocol.bedrock.codec.v671.Bedrock_v671; import org.cloudburstmc.protocol.bedrock.codec.v671.Bedrock_v671;
import org.cloudburstmc.protocol.bedrock.netty.codec.packet.BedrockPacketCodec; import org.cloudburstmc.protocol.bedrock.netty.codec.packet.BedrockPacketCodec;
import org.cloudburstmc.protocol.bedrock.packet.AnvilDamagePacket;
import org.cloudburstmc.protocol.bedrock.packet.BedrockPacket; import org.cloudburstmc.protocol.bedrock.packet.BedrockPacket;
import org.cloudburstmc.protocol.bedrock.packet.BossEventPacket; import org.cloudburstmc.protocol.bedrock.packet.BossEventPacket;
import org.cloudburstmc.protocol.bedrock.packet.ClientCacheBlobStatusPacket; import org.cloudburstmc.protocol.bedrock.packet.ClientCacheBlobStatusPacket;
import org.cloudburstmc.protocol.bedrock.packet.ClientCacheStatusPacket;
import org.cloudburstmc.protocol.bedrock.packet.ClientCheatAbilityPacket; import org.cloudburstmc.protocol.bedrock.packet.ClientCheatAbilityPacket;
import org.cloudburstmc.protocol.bedrock.packet.ClientToServerHandshakePacket;
import org.cloudburstmc.protocol.bedrock.packet.CraftingEventPacket; import org.cloudburstmc.protocol.bedrock.packet.CraftingEventPacket;
import org.cloudburstmc.protocol.bedrock.packet.CreatePhotoPacket; import org.cloudburstmc.protocol.bedrock.packet.CreatePhotoPacket;
import org.cloudburstmc.protocol.bedrock.packet.DebugInfoPacket;
import org.cloudburstmc.protocol.bedrock.packet.DisconnectPacket;
import org.cloudburstmc.protocol.bedrock.packet.EditorNetworkPacket; import org.cloudburstmc.protocol.bedrock.packet.EditorNetworkPacket;
import org.cloudburstmc.protocol.bedrock.packet.EntityFallPacket;
import org.cloudburstmc.protocol.bedrock.packet.GameTestRequestPacket;
import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket; import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket;
import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket; import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket;
import org.cloudburstmc.protocol.bedrock.packet.LabTablePacket; import org.cloudburstmc.protocol.bedrock.packet.LabTablePacket;
import org.cloudburstmc.protocol.bedrock.packet.MapCreateLockedCopyPacket;
import org.cloudburstmc.protocol.bedrock.packet.MapInfoRequestPacket;
import org.cloudburstmc.protocol.bedrock.packet.MobArmorEquipmentPacket; import org.cloudburstmc.protocol.bedrock.packet.MobArmorEquipmentPacket;
import org.cloudburstmc.protocol.bedrock.packet.MobEquipmentPacket; import org.cloudburstmc.protocol.bedrock.packet.MobEquipmentPacket;
import org.cloudburstmc.protocol.bedrock.packet.MultiplayerSettingsPacket;
import org.cloudburstmc.protocol.bedrock.packet.NpcRequestPacket;
import org.cloudburstmc.protocol.bedrock.packet.PhotoInfoRequestPacket; import org.cloudburstmc.protocol.bedrock.packet.PhotoInfoRequestPacket;
import org.cloudburstmc.protocol.bedrock.packet.PhotoTransferPacket; import org.cloudburstmc.protocol.bedrock.packet.PhotoTransferPacket;
import org.cloudburstmc.protocol.bedrock.packet.PlayerAuthInputPacket; import org.cloudburstmc.protocol.bedrock.packet.PlayerAuthInputPacket;
import org.cloudburstmc.protocol.bedrock.packet.PlayerHotbarPacket;
import org.cloudburstmc.protocol.bedrock.packet.PlayerSkinPacket;
import org.cloudburstmc.protocol.bedrock.packet.PurchaseReceiptPacket; import org.cloudburstmc.protocol.bedrock.packet.PurchaseReceiptPacket;
import org.cloudburstmc.protocol.bedrock.packet.ScriptCustomEventPacket;
import org.cloudburstmc.protocol.bedrock.packet.ScriptMessagePacket;
import org.cloudburstmc.protocol.bedrock.packet.SetEntityDataPacket;
import org.cloudburstmc.protocol.bedrock.packet.SetEntityLinkPacket;
import org.cloudburstmc.protocol.bedrock.packet.SetEntityMotionPacket;
import org.cloudburstmc.protocol.bedrock.packet.SettingsCommandPacket;
import org.cloudburstmc.protocol.bedrock.packet.SimpleEventPacket;
import org.cloudburstmc.protocol.bedrock.packet.SubChunkRequestPacket;
import org.cloudburstmc.protocol.bedrock.packet.SubClientLoginPacket; import org.cloudburstmc.protocol.bedrock.packet.SubClientLoginPacket;
import org.cloudburstmc.protocol.bedrock.packet.TickSyncPacket;
import org.cloudburstmc.protocol.common.util.VarInts; import org.cloudburstmc.protocol.common.util.VarInts;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -200,18 +227,28 @@ public final class GameProtocol {
.updateSerializer(PhotoTransferPacket.class, setIllegalSerializer()) .updateSerializer(PhotoTransferPacket.class, setIllegalSerializer())
.updateSerializer(LabTablePacket.class, setIllegalSerializer()) .updateSerializer(LabTablePacket.class, setIllegalSerializer())
.updateSerializer(CreatePhotoPacket.class, setIllegalSerializer()) .updateSerializer(CreatePhotoPacket.class, setIllegalSerializer())
.updateSerializer(NpcRequestPacket.class, setIllegalSerializer())
.updateSerializer(PhotoInfoRequestPacket.class, setIllegalSerializer()) .updateSerializer(PhotoInfoRequestPacket.class, setIllegalSerializer())
// Illegal unused serverbound packets for featured servers // Illegal unused serverbound packets for featured servers
.updateSerializer(PurchaseReceiptPacket.class, setIllegalSerializer()) .updateSerializer(PurchaseReceiptPacket.class, setIllegalSerializer())
// Illegal unused serverbound packets for editor
.updateSerializer(EditorNetworkPacket.class, setIllegalSerializer())
// Illegal unused serverbound packets that are deprecated // Illegal unused serverbound packets that are deprecated
.updateSerializer(ClientCheatAbilityPacket.class, setIllegalSerializer()) .updateSerializer(ClientCheatAbilityPacket.class, setIllegalSerializer())
// Illegal unusued serverbound packets that relate to unused features // Illegal unusued serverbound packets that relate to unused features
.updateSerializer(PlayerAuthInputPacket.class, setIllegalSerializer()) .updateSerializer(PlayerAuthInputPacket.class, setIllegalSerializer())
.updateSerializer(ClientCacheBlobStatusPacket.class, setIllegalSerializer()) .updateSerializer(ClientCacheBlobStatusPacket.class, setIllegalSerializer())
.updateSerializer(ClientCacheStatusPacket.class, setIllegalSerializer())
.updateSerializer(SubClientLoginPacket.class, setIllegalSerializer()) .updateSerializer(SubClientLoginPacket.class, setIllegalSerializer())
// Illegal serverbound packets due to Geyser specific setup .updateSerializer(SubChunkRequestPacket.class, setIllegalSerializer())
.updateSerializer(GameTestRequestPacket.class, setIllegalSerializer())
// Ignored serverbound packets
.updateSerializer(CraftingEventPacket.class, setIgnoredSerializer()) // Make illegal when 1.20.40 is removed
.updateSerializer(ClientToServerHandshakePacket.class, setIgnoredSerializer())
.updateSerializer(EntityFallPacket.class, setIgnoredSerializer())
.updateSerializer(MapCreateLockedCopyPacket.class, setIgnoredSerializer())
.updateSerializer(MapInfoRequestPacket.class, setIgnoredSerializer())
.updateSerializer(SettingsCommandPacket.class, setIgnoredSerializer())
.updateSerializer(AnvilDamagePacket.class, setIgnoredSerializer())
// Illegal when serverbound due to Geyser specific setup
.updateSerializer(InventoryContentPacket.class, new InventoryContentSerializer_v407() { .updateSerializer(InventoryContentPacket.class, new InventoryContentSerializer_v407() {
@Override @Override
public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, InventoryContentPacket packet) { public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, InventoryContentPacket packet) {
@ -224,18 +261,27 @@ public final class GameProtocol {
throw new IllegalArgumentException("Client cannot send InventorySlotPacket in server-auth inventory environment!"); throw new IllegalArgumentException("Client cannot send InventorySlotPacket in server-auth inventory environment!");
} }
}) })
// Ignored serverbound packets
.updateSerializer(CraftingEventPacket.class, setIgnoredSerializer()) // Make illegal when 1.20.40 is removed
// Ignored only when serverbound // Ignored only when serverbound
.updateSerializer(BossEventPacket.class, new BossEventSerializer_v486() { .updateSerializer(BossEventPacket.class, new BossEventSerializer_v486() {
@Override @Override public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, BossEventPacket packet) {}
public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, BossEventPacket packet) {
}
}) })
.updateSerializer(MobArmorEquipmentPacket.class, new MobArmorEquipmentSerializer_v291() { .updateSerializer(MobArmorEquipmentPacket.class, new MobArmorEquipmentSerializer_v291() {
@Override @Override public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, MobArmorEquipmentPacket packet) {}
public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, MobArmorEquipmentPacket packet) { })
} .updateSerializer(PlayerHotbarPacket.class, new PlayerHotbarSerializer_v291() {
@Override public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, PlayerHotbarPacket packet) {}
})
.updateSerializer(PlayerSkinPacket.class, new PlayerSkinSerializer_v390() {
@Override public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, PlayerSkinPacket packet) {}
})
.updateSerializer(SetEntityDataPacket.class, new SetEntityDataSerializer_v557() {
@Override public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, SetEntityDataPacket packet) {}
})
.updateSerializer(SetEntityMotionPacket.class, new SetEntityMotionSerializer_v662() {
@Override public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, SetEntityMotionPacket packet) {}
})
.updateSerializer(SetEntityLinkPacket.class, new SetEntityLinkSerializer_v291() {
@Override public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, SetEntityLinkPacket packet) {}
}) })
// Valid serverbound packets where reading of some fields can be skipped // Valid serverbound packets where reading of some fields can be skipped
.updateSerializer(MobEquipmentPacket.class, new MobEquipmentSerializer_v291() { .updateSerializer(MobEquipmentPacket.class, new MobEquipmentSerializer_v291() {
@ -248,6 +294,16 @@ public final class GameProtocol {
packet.setContainerId(buffer.readByte()); packet.setContainerId(buffer.readByte());
} }
}) })
// Illegal bidirectional packets
.updateSerializer(DebugInfoPacket.class, setIllegalSerializer())
.updateSerializer(EditorNetworkPacket.class, setIllegalSerializer())
.updateSerializer(ScriptCustomEventPacket.class, setIllegalSerializer())
.updateSerializer(ScriptMessagePacket.class, setIllegalSerializer())
// Ignored bidirectional packets
.updateSerializer(DisconnectPacket.class, setIgnoredSerializer())
.updateSerializer(SimpleEventPacket.class, setIgnoredSerializer())
.updateSerializer(TickSyncPacket.class, setIgnoredSerializer())
.updateSerializer(MultiplayerSettingsPacket.class, setIgnoredSerializer())
.build(); .build();
} }

View file

@ -118,9 +118,9 @@ websocket = { group = "org.java-websocket", name = "Java-WebSocket", version.ref
#protocol-common = { group = "org.cloudburstmc.protocol", name = "common", version.ref = "protocol-connection" } #protocol-common = { group = "org.cloudburstmc.protocol", name = "common", version.ref = "protocol-connection" }
#protocol-codec = { group = "org.cloudburstmc.protocol", name = "bedrock-codec", version.ref = "protocol" } #protocol-codec = { group = "org.cloudburstmc.protocol", name = "bedrock-codec", version.ref = "protocol" }
#protocol-connection = { group = "org.cloudburstmc.protocol", name = "bedrock-connection", version.ref = "protocol-connection" } #protocol-connection = { group = "org.cloudburstmc.protocol", name = "bedrock-connection", version.ref = "protocol-connection" }
protocol-common = { group = "com.github.Kas-tle.Protocol", name = "common", version = "4902471" } # Remove before merge protocol-common = { group = "com.github.Kas-tle.Protocol", name = "common", version = "8dac7d9" } # Remove before merge
protocol-codec = { group = "com.github.Kas-tle.Protocol", name = "bedrock-codec", version = "4902471" } # Remove before merge protocol-codec = { group = "com.github.Kas-tle.Protocol", name = "bedrock-codec", version = "8dac7d9" } # Remove before merge
protocol-connection = { group = "com.github.Kas-tle.Protocol", name = "bedrock-connection", version = "4902471" } # Remove before merge protocol-connection = { group = "com.github.Kas-tle.Protocol", name = "bedrock-connection", version = "8dac7d9" } # Remove before merge
math = { group = "org.cloudburstmc.math", name = "immutable", version = "2.0" } math = { group = "org.cloudburstmc.math", name = "immutable", version = "2.0" }