From aebfbfb8c8d623ded8d409d29983a5e871a475bc Mon Sep 17 00:00:00 2001 From: Lane Kolbly Date: Sat, 2 Sep 2017 11:46:57 -0500 Subject: GetPacketID for protocol packet IDs (#3977) * Added GetPacketId method to protocol, implemented for all protocols. * Moved GetPacketID methods into a single file, alpha-sorted. * Fixed 1.12.1 HandlePacket switch statement. * Added SendLogin to the GetPacketId framework. * Added SpawnObject to GetPacketId framework. * Added missing sendEntityEquipment packet ID update for 1.12.1 * Added LeashEntity packet ID change to 1.12.1 * Alphabetized packet enum, added SpawnGlobalEntity to GetPacketId framework * Fixed clang errors * Indented cases, expanded comment for GetPacketId * Changed dyslexic comment. --- src/Protocol/Protocol_1_11.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Protocol/Protocol_1_11.cpp') diff --git a/src/Protocol/Protocol_1_11.cpp b/src/Protocol/Protocol_1_11.cpp index b9b6e9ac3..ba7742493 100644 --- a/src/Protocol/Protocol_1_11.cpp +++ b/src/Protocol/Protocol_1_11.cpp @@ -342,7 +342,7 @@ void cProtocol_1_11_0::SendCollectEntity(const cEntity & a_Entity, const cPlayer { ASSERT(m_State == 3); // In game mode? - cPacketizer Pkt(*this, 0x48); // Collect Item packet + cPacketizer Pkt(*this, GetPacketId(sendCollectEntity)); // Collect Item packet Pkt.WriteVarInt32(a_Entity.GetUniqueID()); Pkt.WriteVarInt32(a_Player.GetUniqueID()); Pkt.WriteVarInt32(static_cast(a_Count)); @@ -356,7 +356,7 @@ void cProtocol_1_11_0::SendHideTitle(void) { ASSERT(m_State == 3); // In game mode? - cPacketizer Pkt(*this, 0x45); // Title packet + cPacketizer Pkt(*this, GetPacketId(sendTitle)); // Title packet Pkt.WriteVarInt32(4); // Hide title } @@ -368,7 +368,7 @@ void cProtocol_1_11_0::SendResetTitle(void) { ASSERT(m_State == 3); // In game mode? - cPacketizer Pkt(*this, 0x45); // Title packet + cPacketizer Pkt(*this, GetPacketId(sendTitle)); // Title packet Pkt.WriteVarInt32(5); // Reset title } @@ -380,7 +380,7 @@ void cProtocol_1_11_0::SendSpawnMob(const cMonster & a_Mob) { ASSERT(m_State == 3); // In game mode? - cPacketizer Pkt(*this, 0x03); // Spawn Mob packet + cPacketizer Pkt(*this, GetPacketId(sendSpawnMob)); // Spawn Mob packet Pkt.WriteVarInt32(a_Mob.GetUniqueID()); // TODO: Bad way to write a UUID, and it's not a true UUID, but this is functional for now. Pkt.WriteBEUInt64(0); -- cgit v1.2.3