From 9126fef6625039511a4b659efc918c9d365699b7 Mon Sep 17 00:00:00 2001 From: Tnze Date: Sat, 18 Nov 2023 22:54:16 +0800 Subject: [PATCH] update packetid --- data/packetid/generator/Main.java | 5 ++++ data/packetid/legacy.go | 31 ++++++++++++++++++++ data/packetid/packetid.go | 48 +++++++++++++++++++++++-------- 3 files changed, 72 insertions(+), 12 deletions(-) create mode 100644 data/packetid/legacy.go diff --git a/data/packetid/generator/Main.java b/data/packetid/generator/Main.java index 8492fa7..2bff17b 100644 --- a/data/packetid/generator/Main.java +++ b/data/packetid/generator/Main.java @@ -23,6 +23,11 @@ public class Main { handlePackets(w, ConnectionProtocol.STATUS.getPacketsByIds(PacketFlow.SERVERBOUND)); System.out.println(); System.out.println(); + handlePackets(w, ConnectionProtocol.CONFIGURATION.getPacketsByIds(PacketFlow.CLIENTBOUND)); + System.out.println(); + handlePackets(w, ConnectionProtocol.CONFIGURATION.getPacketsByIds(PacketFlow.SERVERBOUND)); + System.out.println(); + System.out.println(); handlePackets(w, ConnectionProtocol.PLAY.getPacketsByIds(PacketFlow.CLIENTBOUND)); System.out.println(); handlePackets(w, ConnectionProtocol.PLAY.getPacketsByIds(PacketFlow.SERVERBOUND)); diff --git a/data/packetid/legacy.go b/data/packetid/legacy.go new file mode 100644 index 0000000..8b35e99 --- /dev/null +++ b/data/packetid/legacy.go @@ -0,0 +1,31 @@ +package packetid + +// This file might be remove in the future go-mc!!! + +// Login Clientbound +const ( + LoginDisconnect = iota + LoginEncryptionRequest + LoginSuccess + LoginCompression + LoginPluginRequest +) + +// Login Serverbound +const ( + LoginStart = iota + LoginEncryptionResponse + LoginPluginResponse +) + +// Status Clientbound +const ( + StatusResponse = iota + StatusPongResponse +) + +// Status Serverbound +const ( + StatusRequest = iota + StatusPingRequest +) diff --git a/data/packetid/packetid.go b/data/packetid/packetid.go index ecf06dc..4c6cd8e 100644 --- a/data/packetid/packetid.go +++ b/data/packetid/packetid.go @@ -9,30 +9,54 @@ type ( // Login Clientbound const ( - LoginDisconnect = iota - LoginEncryptionRequest - LoginSuccess - LoginCompression - LoginPluginRequest + ClientboundLoginDisconnect ClientboundPacketID = iota // LoginDisconnect + ClientboundLoginEncryptionRequest // Hello + ClientboundLoginSuccess // GameProfile + ClientboundLoginCompression // LoginCompression + ClientboundLoginPluginRequest // CustomQuery ) // Login Serverbound const ( - LoginStart = iota - LoginEncryptionResponse - LoginPluginResponse + ServerboundLoginStart ServerboundPacketID = iota // Hello + ServerboundLoginEncryptionResponse // Key + ServerboundLoginPluginResponse // CustomQueryAnswer + ServerboundLoginAcknowledged // LoginAcknowledged ) // Status Clientbound const ( - StatusResponse = iota - StatusPongResponse + ClientboundStatusResponse ClientboundPacketID = iota + ClientboundStatusPongResponse ) // Status Serverbound const ( - StatusRequest = iota - StatusPingRequest + ServerboundStatusRequest ServerboundPacketID = iota + ServerboundStatusPingRequest +) + +// Configuration Clientbound +const ( + ClientboundConfigCustomPayload ClientboundPacketID = iota + ClientboundConfigDisconnect + ClientboundConfigFinishConfiguration + ClientboundConfigKeepAlive + ClientboundConfigPing + ClientboundConfigRegistryData + ClientboundConfigResourcePack + ClientboundConfigUpdateEnabledFeatures + ClientboundConfigUpdateTags +) + +// Configuration Serverbound +const ( + ServerboundConfigClientInformation ServerboundPacketID = iota + ServerboundConfigCustomPayload + ServerboundConfigFinishConfiguration + ServerboundConfigKeepAlive + ServerboundConfigPong + ServerboundConfigResourcePack ) // Game Clientbound