1
0

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.
This commit is contained in:
Lane Kolbly
2017-09-02 11:46:57 -05:00
committed by Alexander Harkness
parent 49c443896d
commit aebfbfb8c8
11 changed files with 366 additions and 1359 deletions

View File

@@ -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<UInt32>(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);