From 2c804dd34a58ff9702bd1ab2cab30f6a61503638 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Mon, 9 Sep 2019 18:22:37 +0200 Subject: Protocol: Use logical outgoing packet types. --- src/Protocol/Protocol_1_11.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 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 bbfcd6d94..9c8e0c544 100644 --- a/src/Protocol/Protocol_1_11.cpp +++ b/src/Protocol/Protocol_1_11.cpp @@ -5,7 +5,8 @@ Implements the 1.11 protocol classes: - cProtocol_1_11_0 - release 1.11 protocol (#315) -(others may be added later in the future for the 1.11 release series) + - cProtocol_1_11_1 + - release 1.11.1 protocol (#316) */ #include "Globals.h" @@ -332,7 +333,7 @@ namespace Metadata cProtocol_1_11_0::cProtocol_1_11_0(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) : - super(a_Client, a_ServerAddress, a_ServerPort, a_State) + Super(a_Client, a_ServerAddress, a_ServerPort, a_State) { } @@ -344,7 +345,7 @@ void cProtocol_1_11_0::SendCollectEntity(const cEntity & a_Entity, const cPlayer { ASSERT(m_State == 3); // In game mode? - cPacketizer Pkt(*this, GetPacketId(sendCollectEntity)); // Collect Item packet + cPacketizer Pkt(*this, pktCollectEntity); Pkt.WriteVarInt32(a_Entity.GetUniqueID()); Pkt.WriteVarInt32(a_Player.GetUniqueID()); Pkt.WriteVarInt32(static_cast(a_Count)); @@ -358,7 +359,7 @@ void cProtocol_1_11_0::SendHideTitle(void) { ASSERT(m_State == 3); // In game mode? - cPacketizer Pkt(*this, GetPacketId(sendTitle)); // Title packet + cPacketizer Pkt(*this, pktTitle); Pkt.WriteVarInt32(4); // Hide title } @@ -370,7 +371,7 @@ void cProtocol_1_11_0::SendResetTitle(void) { ASSERT(m_State == 3); // In game mode? - cPacketizer Pkt(*this, GetPacketId(sendTitle)); // Title packet + cPacketizer Pkt(*this, pktTitle); Pkt.WriteVarInt32(5); // Reset title } @@ -382,7 +383,7 @@ void cProtocol_1_11_0::SendSpawnMob(const cMonster & a_Mob) { ASSERT(m_State == 3); // In game mode? - cPacketizer Pkt(*this, GetPacketId(sendSpawnMob)); // Spawn Mob packet + cPacketizer Pkt(*this, pktSpawnMob); 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); @@ -526,7 +527,7 @@ void cProtocol_1_11_0::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int { ASSERT(m_State == 3); // In game mode? - cPacketizer Pkt(*this, 0x45); // Title packet + cPacketizer Pkt(*this, pktTitle); Pkt.WriteVarInt32(3); // Set title display times Pkt.WriteBEInt32(a_FadeInTicks); Pkt.WriteBEInt32(a_DisplayTicks); @@ -594,7 +595,7 @@ void cProtocol_1_11_0::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) // Serialize the response into a packet: Json::FastWriter Writer; - cPacketizer Pkt(*this, 0x00); // Response packet + cPacketizer Pkt(*this, pktStatusResponse); Pkt.WriteString(Writer.write(ResponseValue)); } @@ -1175,7 +1176,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ cProtocol_1_11_1::cProtocol_1_11_1(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) : - super(a_Client, a_ServerAddress, a_ServerPort, a_State) + Super(a_Client, a_ServerAddress, a_ServerPort, a_State) { } @@ -1220,6 +1221,6 @@ void cProtocol_1_11_1::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) // Serialize the response into a packet: Json::FastWriter Writer; - cPacketizer Pkt(*this, 0x00); // Response packet + cPacketizer Pkt(*this, pktStatusResponse); Pkt.WriteString(Writer.write(ResponseValue)); } -- cgit v1.2.3