diff options
Diffstat (limited to '')
-rw-r--r-- | src/Protocol/CMakeLists.txt | 20 | ||||
-rw-r--r-- | src/Protocol/ChunkDataSerializer.cpp | 10 | ||||
-rw-r--r-- | src/Protocol/Protocol.h | 2 | ||||
-rw-r--r-- | src/Protocol/ProtocolRecognizer.cpp | 36 | ||||
-rw-r--r-- | src/Protocol/ProtocolRecognizer.h | 7 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_10.cpp (renamed from src/Protocol/Protocol110x.cpp) | 21 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_10.h (renamed from src/Protocol/Protocol110x.h) | 23 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_11.cpp | 189 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_11.h | 41 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_8.cpp (renamed from src/Protocol/Protocol18x.cpp) | 288 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_8.h (renamed from src/Protocol/Protocol18x.h) | 15 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_9.cpp (renamed from src/Protocol/Protocol19x.cpp) | 337 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_9.h (renamed from src/Protocol/Protocol19x.h) | 120 |
13 files changed, 668 insertions, 441 deletions
diff --git a/src/Protocol/CMakeLists.txt b/src/Protocol/CMakeLists.txt index 13afb76f4..e8e485ddf 100644 --- a/src/Protocol/CMakeLists.txt +++ b/src/Protocol/CMakeLists.txt @@ -7,9 +7,10 @@ SET (SRCS ChunkDataSerializer.cpp MojangAPI.cpp Packetizer.cpp - Protocol18x.cpp - Protocol19x.cpp - Protocol110x.cpp + Protocol_1_8.cpp + Protocol_1_9.cpp + Protocol_1_10.cpp + Protocol_1_11.cpp ProtocolRecognizer.cpp ) @@ -19,16 +20,17 @@ SET (HDRS MojangAPI.h Packetizer.h Protocol.h - Protocol18x.h - Protocol19x.h - Protocol110x.h + Protocol_1_8.h + Protocol_1_9.h + Protocol_1_10.h + Protocol_1_11.h ProtocolRecognizer.h ) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set_source_files_properties(Protocol19x.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=switch") - set_source_files_properties(Protocol18x.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=switch") - set_source_files_properties(Protocol110x.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch") + set_source_files_properties(Protocol_1_9.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=switch") + set_source_files_properties(Protocol_1_8.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=switch") + set_source_files_properties(Protocol_1_10.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch") endif() if (NOT MSVC) diff --git a/src/Protocol/ChunkDataSerializer.cpp b/src/Protocol/ChunkDataSerializer.cpp index c7fd504a1..bbedb3c59 100644 --- a/src/Protocol/ChunkDataSerializer.cpp +++ b/src/Protocol/ChunkDataSerializer.cpp @@ -9,8 +9,8 @@ #include "ChunkDataSerializer.h" #include "zlib/zlib.h" #include "ByteBuffer.h" -#include "Protocol18x.h" -#include "Protocol19x.h" +#include "Protocol_1_8.h" +#include "Protocol_1_9.h" @@ -111,7 +111,7 @@ void cChunkDataSerializer::Serialize47(AString & a_Data, int a_ChunkX, int a_Chu cByteBuffer Buffer(20); if (PacketData.size() >= 256) { - if (!cProtocol180::CompressPacket(PacketData, a_Data)) + if (!cProtocol_1_8_0::CompressPacket(PacketData, a_Data)) { ASSERT(!"Packet compression failed."); a_Data.clear(); @@ -254,7 +254,7 @@ void cChunkDataSerializer::Serialize107(AString & a_Data, int a_ChunkX, int a_Ch cByteBuffer Buffer(20); if (PacketData.size() >= 256) { - if (!cProtocol190::CompressPacket(PacketData, a_Data)) + if (!cProtocol_1_9_0::CompressPacket(PacketData, a_Data)) { ASSERT(!"Packet compression failed."); a_Data.clear(); @@ -400,7 +400,7 @@ void cChunkDataSerializer::Serialize110(AString & a_Data, int a_ChunkX, int a_Ch cByteBuffer Buffer(20); if (PacketData.size() >= 256) { - if (!cProtocol190::CompressPacket(PacketData, a_Data)) + if (!cProtocol_1_9_0::CompressPacket(PacketData, a_Data)) { ASSERT(!"Packet compression failed."); a_Data.clear(); diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h index 137a47acc..d20c37a29 100644 --- a/src/Protocol/Protocol.h +++ b/src/Protocol/Protocol.h @@ -74,7 +74,7 @@ public: virtual void SendChat (const cCompositeChat & a_Message, eChatType a_Type, bool a_ShouldUseChatPrefixes) = 0; virtual void SendChatRaw (const AString & a_MessageRaw, eChatType a_Type) = 0; virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) = 0; - virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) = 0; + virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player, int a_Count) = 0; virtual void SendDestroyEntity (const cEntity & a_Entity) = 0; virtual void SendDetachEntity (const cEntity & a_Entity, const cEntity & a_PreviousVehicle) = 0; virtual void SendDisconnect (const AString & a_Reason) = 0; diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp index 0c67f66f5..04ac1bb2b 100644 --- a/src/Protocol/ProtocolRecognizer.cpp +++ b/src/Protocol/ProtocolRecognizer.cpp @@ -7,9 +7,10 @@ #include "Globals.h" #include "ProtocolRecognizer.h" -#include "Protocol18x.h" -#include "Protocol19x.h" -#include "Protocol110x.h" +#include "Protocol_1_8.h" +#include "Protocol_1_9.h" +#include "Protocol_1_10.h" +#include "Protocol_1_11.h" #include "Packetizer.h" #include "../ClientHandle.h" #include "../Root.h" @@ -53,7 +54,8 @@ AString cProtocolRecognizer::GetVersionTextFromInt(int a_ProtocolVersion) case PROTO_VERSION_1_9_1: return "1.9.1"; case PROTO_VERSION_1_9_2: return "1.9.2"; case PROTO_VERSION_1_9_4: return "1.9.4"; - case PROTO_VERSION_1_10_0: return "1.10"; + case PROTO_VERSION_1_10_0: return "1.10"; + case PROTO_VERSION_1_11_0: return "1.11"; } ASSERT(!"Unknown protocol version"); return Printf("Unknown protocol (%d)", a_ProtocolVersion); @@ -220,10 +222,10 @@ void cProtocolRecognizer::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSe -void cProtocolRecognizer::SendCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player) +void cProtocolRecognizer::SendCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player, int a_Count) { ASSERT(m_Protocol != nullptr); - m_Protocol->SendCollectEntity(a_Entity, a_Player); + m_Protocol->SendCollectEntity(a_Entity, a_Player, a_Count); } @@ -978,8 +980,7 @@ void cProtocolRecognizer::SendData(const char * a_Data, size_t a_Size) bool cProtocolRecognizer::TryRecognizeProtocol(void) { - // NOTE: If a new protocol is added or an old one is removed, adjust MCS_CLIENT_VERSIONS and - // MCS_PROTOCOL_VERSIONS macros in the header file, as well as PROTO_VERSION_LATEST macro + // NOTE: If a new protocol is added or an old one is removed, adjust MCS_CLIENT_VERSIONS and MCS_PROTOCOL_VERSIONS macros in the header file // Lengthed protocol, try if it has the entire initial handshake packet: UInt32 PacketLen; @@ -1045,37 +1046,42 @@ bool cProtocolRecognizer::TryRecognizeLengthedProtocol(UInt32 a_PacketLengthRema case PROTO_VERSION_1_8_0: { m_Buffer.CommitRead(); - m_Protocol = new cProtocol180(m_Client, ServerAddress, ServerPort, NextState); + m_Protocol = new cProtocol_1_8_0(m_Client, ServerAddress, ServerPort, NextState); return true; } case PROTO_VERSION_1_9_0: { - m_Protocol = new cProtocol190(m_Client, ServerAddress, ServerPort, NextState); + m_Protocol = new cProtocol_1_9_0(m_Client, ServerAddress, ServerPort, NextState); return true; } case PROTO_VERSION_1_9_1: { - m_Protocol = new cProtocol191(m_Client, ServerAddress, ServerPort, NextState); + m_Protocol = new cProtocol_1_9_1(m_Client, ServerAddress, ServerPort, NextState); return true; } case PROTO_VERSION_1_9_2: { - m_Protocol = new cProtocol192(m_Client, ServerAddress, ServerPort, NextState); + m_Protocol = new cProtocol_1_9_2(m_Client, ServerAddress, ServerPort, NextState); return true; } case PROTO_VERSION_1_9_4: { - m_Protocol = new cProtocol194(m_Client, ServerAddress, ServerPort, NextState); + m_Protocol = new cProtocol_1_9_4(m_Client, ServerAddress, ServerPort, NextState); return true; } case PROTO_VERSION_1_10_0: { - m_Protocol = new cProtocol1100(m_Client, ServerAddress, ServerPort, NextState); + m_Protocol = new cProtocol_1_10_0(m_Client, ServerAddress, ServerPort, NextState); + return true; + } + case PROTO_VERSION_1_11_0: + { + m_Protocol = new cProtocol_1_11_0(m_Client, ServerAddress, ServerPort, NextState); return true; } default: { - LOGINFO("Client \"%s\" uses an unsupported protocol (lengthed, version %u (0x%x))", + LOGD("Client \"%s\" uses an unsupported protocol (lengthed, version %u (0x%x))", m_Client->GetIPString().c_str(), ProtocolVersion, ProtocolVersion ); if (NextState != 1) diff --git a/src/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h index 560819705..081b2136e 100644 --- a/src/Protocol/ProtocolRecognizer.h +++ b/src/Protocol/ProtocolRecognizer.h @@ -18,8 +18,8 @@ // Adjust these if a new protocol is added or an old one is removed: -#define MCS_CLIENT_VERSIONS "1.8.x, 1.9.x, 1.10.x" -#define MCS_PROTOCOL_VERSIONS "47, 107, 108, 109, 110, 210" +#define MCS_CLIENT_VERSIONS "1.8.x, 1.9.x, 1.10.x, 1.11" +#define MCS_PROTOCOL_VERSIONS "47, 107, 108, 109, 110, 210, 315" @@ -39,6 +39,7 @@ public: PROTO_VERSION_1_9_2 = 109, PROTO_VERSION_1_9_4 = 110, PROTO_VERSION_1_10_0 = 210, + PROTO_VERSION_1_11_0 = 315, } ; cProtocolRecognizer(cClientHandle * a_Client); @@ -61,7 +62,7 @@ public: virtual void SendChat (const cCompositeChat & a_Message, eChatType a_Type, bool a_ShouldUseChatPrefixes) override; virtual void SendChatRaw (const AString & a_MessageRaw, eChatType a_Type) override; virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override; - virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) override; + virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player, int a_Count) override; virtual void SendDestroyEntity (const cEntity & a_Entity) override; virtual void SendDetachEntity (const cEntity & a_Entity, const cEntity & a_PreviousVehicle) override; virtual void SendDisconnect (const AString & a_Reason) override; diff --git a/src/Protocol/Protocol110x.cpp b/src/Protocol/Protocol_1_10.cpp index 48ea0c6ba..c0d9d921f 100644 --- a/src/Protocol/Protocol110x.cpp +++ b/src/Protocol/Protocol_1_10.cpp @@ -1,15 +1,14 @@ -// Protocol110x.cpp +// Protocol_1_10.cpp /* -Implements the 1.10.x protocol classes: - - cProtocol1100 - - release 1.10.0 protocol (#210) -(others may be added later in the future for the 1.10 release series) +Implements the 1.10 protocol classes: + - cProtocol_1_10_0 + - release 1.10 protocol (#210), also used by 1.10.1 and 1.10.2 */ #include "Globals.h" -#include "Protocol110x.h" +#include "Protocol_1_10.h" #include "Packetizer.h" #include "json/json.h" @@ -283,7 +282,7 @@ namespace Metadata -cProtocol1100::cProtocol1100(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) : +cProtocol_1_10_0::cProtocol_1_10_0(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) : super(a_Client, a_ServerAddress, a_ServerPort, a_State) { } @@ -292,7 +291,7 @@ cProtocol1100::cProtocol1100(cClientHandle * a_Client, const AString &a_ServerAd -void cProtocol1100::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) +void cProtocol_1_10_0::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) { ASSERT(m_State == 3); // In game mode? @@ -310,7 +309,7 @@ void cProtocol1100::SendSoundEffect(const AString & a_SoundName, double a_X, dou -void cProtocol1100::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) +void cProtocol_1_10_0::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) { cServer * Server = cRoot::Get()->GetServer(); AString ServerDescription = Server->GetDescription(); @@ -355,7 +354,7 @@ void cProtocol1100::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) -void cProtocol1100::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_Entity) +void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_Entity) { using namespace Metadata; @@ -552,7 +551,7 @@ void cProtocol1100::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_E -void cProtocol1100::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob) +void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob) { using namespace Metadata; diff --git a/src/Protocol/Protocol110x.h b/src/Protocol/Protocol_1_10.h index 64ef8acb5..df64758e4 100644 --- a/src/Protocol/Protocol110x.h +++ b/src/Protocol/Protocol_1_10.h @@ -1,11 +1,10 @@ -// Protocol110x.h +// Protocol_1_10.h /* -Declares the 1.10.x protocol classes: - - cProtocol1100 - - release 1.10.0 protocol (#210) -(others may be added later in the future for the 1.10 release series) +Declares the 1.10 protocol classes: + - cProtocol_1_10 + - release 1.10 protocol (#210), also used by 1.10.1 and 1.10.2 */ @@ -14,15 +13,19 @@ Declares the 1.10.x protocol classes: #pragma once -#include "Protocol19x.h" +#include "Protocol_1_9.h" -class cProtocol1100 : - public cProtocol194 + + + + +class cProtocol_1_10_0 : + public cProtocol_1_9_4 { - typedef cProtocol194 super; + typedef cProtocol_1_9_4 super; public: - cProtocol1100(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State); + cProtocol_1_10_0(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State); virtual void SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override; diff --git a/src/Protocol/Protocol_1_11.cpp b/src/Protocol/Protocol_1_11.cpp new file mode 100644 index 000000000..5d6eca508 --- /dev/null +++ b/src/Protocol/Protocol_1_11.cpp @@ -0,0 +1,189 @@ + +// Protocol_1_11.cpp + +/* +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) +*/ + +#include "Globals.h" +#include "Protocol_1_11.h" +#include "ProtocolRecognizer.h" +#include "Packetizer.h" + +#include "../Root.h" +#include "../Server.h" +#include "../ClientHandle.h" +#include "../CompositeChat.h" +#include "../Bindings/PluginManager.h" +#include "../Entities/Player.h" +#include "../Mobs/Monster.h" + + + + + +#define HANDLE_READ(ByteBuf, Proc, Type, Var) \ + Type Var; \ + if (!ByteBuf.Proc(Var))\ + {\ + return;\ + } + + + + + +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) +{ +} + + + + + +void cProtocol_1_11_0::SendCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player, int a_Count) +{ + ASSERT(m_State == 3); // In game mode? + + cPacketizer Pkt(*this, 0x0d); // Collect Item packet + Pkt.WriteVarInt32(a_Entity.GetUniqueID()); + Pkt.WriteVarInt32(a_Player.GetUniqueID()); + Pkt.WriteVarInt32(static_cast<UInt32>(a_Count)); +} + + + + + +void cProtocol_1_11_0::SendHideTitle(void) +{ + ASSERT(m_State == 3); // In game mode? + + cPacketizer Pkt(*this, 0x45); // Title packet + Pkt.WriteVarInt32(4); // Hide title +} + + + + + +void cProtocol_1_11_0::SendResetTitle(void) +{ + ASSERT(m_State == 3); // In game mode? + + cPacketizer Pkt(*this, 0x45); // Title packet + Pkt.WriteVarInt32(5); // Reset title +} + + + + + +void cProtocol_1_11_0::SendSpawnMob(const cMonster & a_Mob) +{ + ASSERT(m_State == 3); // In game mode? + + cPacketizer Pkt(*this, 0x0f); // Spawn Mob packet + Pkt.WriteVarInt32(a_Mob.GetUniqueID()); + Pkt.WriteVarInt32(static_cast<UInt32>(a_Mob.GetMobType())); + Pkt.WriteFPInt(a_Mob.GetPosX()); + Pkt.WriteFPInt(a_Mob.GetPosY()); + Pkt.WriteFPInt(a_Mob.GetPosZ()); + Pkt.WriteByteAngle(a_Mob.GetPitch()); + Pkt.WriteByteAngle(a_Mob.GetHeadYaw()); + Pkt.WriteByteAngle(a_Mob.GetYaw()); + Pkt.WriteBEInt16(static_cast<Int16>(a_Mob.GetSpeedX() * 400)); + Pkt.WriteBEInt16(static_cast<Int16>(a_Mob.GetSpeedY() * 400)); + Pkt.WriteBEInt16(static_cast<Int16>(a_Mob.GetSpeedZ() * 400)); + WriteEntityMetadata(Pkt, a_Mob); + Pkt.WriteBEUInt8(0x7f); // Metadata terminator +} + + + + + +void cProtocol_1_11_0::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) +{ + ASSERT(m_State == 3); // In game mode? + + cPacketizer Pkt(*this, 0x45); // Title packet + Pkt.WriteVarInt32(3); // Set title display times + Pkt.WriteBEInt32(a_FadeInTicks); + Pkt.WriteBEInt32(a_DisplayTicks); + Pkt.WriteBEInt32(a_FadeOutTicks); +} + + + + + + +void cProtocol_1_11_0::HandlePacketBlockPlace(cByteBuffer & a_ByteBuffer) +{ + int BlockX, BlockY, BlockZ; + if (!a_ByteBuffer.ReadPosition64(BlockX, BlockY, BlockZ)) + { + return; + } + + HANDLE_READ(a_ByteBuffer, ReadVarInt, Int32, Face); + HANDLE_READ(a_ByteBuffer, ReadVarInt, Int32, Hand); + HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, CursorX); + HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, CursorY); + HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, CursorZ); + m_Client->HandleRightClick(BlockX, BlockY, BlockZ, FaceIntToBlockFace(Face), FloorC(CursorX * 16), FloorC(CursorY * 16), FloorC(CursorZ * 16), m_Client->GetPlayer()->GetEquippedItem()); +} + + + + + +void cProtocol_1_11_0::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) +{ + cServer * Server = cRoot::Get()->GetServer(); + AString ServerDescription = Server->GetDescription(); + int NumPlayers = Server->GetNumPlayers(); + int MaxPlayers = Server->GetMaxPlayers(); + AString Favicon = Server->GetFaviconData(); + cRoot::Get()->GetPluginManager()->CallHookServerPing(*m_Client, ServerDescription, NumPlayers, MaxPlayers, Favicon); + + // Version: + Json::Value Version; + Version["name"] = "Cuberite 1.11"; + Version["protocol"] = cProtocolRecognizer::PROTO_VERSION_1_11_0; + + // Players: + Json::Value Players; + Players["online"] = NumPlayers; + Players["max"] = MaxPlayers; + // TODO: Add "sample" + + // Description: + Json::Value Description; + Description["text"] = ServerDescription.c_str(); + + // Create the response: + Json::Value ResponseValue; + ResponseValue["version"] = Version; + ResponseValue["players"] = Players; + ResponseValue["description"] = Description; + if (!Favicon.empty()) + { + ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str()); + } + + // Serialize the response into a packet: + Json::FastWriter Writer; + cPacketizer Pkt(*this, 0x00); // Response packet + Pkt.WriteString(Writer.write(ResponseValue)); +} + + + + + diff --git a/src/Protocol/Protocol_1_11.h b/src/Protocol/Protocol_1_11.h new file mode 100644 index 000000000..a3c7c4d58 --- /dev/null +++ b/src/Protocol/Protocol_1_11.h @@ -0,0 +1,41 @@ + +// Protocol_1_11.h + +/* +Declares 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) +*/ + + + + + +#pragma once + +#include "Protocol_1_10.h" + + + + + +class cProtocol_1_11_0 : + public cProtocol_1_10_0 +{ + typedef cProtocol_1_10_0 super; + +public: + cProtocol_1_11_0(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State); + + virtual void SendCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player, int a_Count) override; + virtual void SendHideTitle (void) override; + virtual void SendResetTitle (void) override; + virtual void SendSpawnMob (const cMonster & a_Mob) override; + virtual void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) override; + +protected: + + virtual void HandlePacketBlockPlace (cByteBuffer & a_ByteBuffer) override; + virtual void HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) override; +}; diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol_1_8.cpp index 0679219a9..bbeb3ae8b 100644 --- a/src/Protocol/Protocol18x.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -1,16 +1,15 @@ -// Protocol18x.cpp +// Protocol_1_8.cpp /* -Implements the 1.8.x protocol classes: - - cProtocol180 - - release 1.8.0 protocol (#47) -(others may be added later in the future for the 1.8 release series) +Implements the 1.8 protocol classes: + - cProtocol_1_8_0 + - release 1.8 protocol (#47) */ #include "Globals.h" #include "json/json.h" -#include "Protocol18x.h" +#include "Protocol_1_8.h" #include "ChunkDataSerializer.h" #include "PolarSSL++/Sha1Checksum.h" #include "Packetizer.h" @@ -99,9 +98,9 @@ extern bool g_ShouldLogCommIn, g_ShouldLogCommOut; //////////////////////////////////////////////////////////////////////////////// -// cProtocol180: +// cProtocol_1_8_0: -cProtocol180::cProtocol180(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) : +cProtocol_1_8_0::cProtocol_1_8_0(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) : super(a_Client), m_ServerAddress(a_ServerAddress), m_ServerPort(a_ServerPort), @@ -146,7 +145,7 @@ cProtocol180::cProtocol180(cClientHandle * a_Client, const AString & a_ServerAdd -void cProtocol180::DataReceived(const char * a_Data, size_t a_Size) +void cProtocol_1_8_0::DataReceived(const char * a_Data, size_t a_Size) { if (m_IsEncrypted) { @@ -170,7 +169,7 @@ void cProtocol180::DataReceived(const char * a_Data, size_t a_Size) -void cProtocol180::SendAttachEntity(const cEntity & a_Entity, const cEntity & a_Vehicle) +void cProtocol_1_8_0::SendAttachEntity(const cEntity & a_Entity, const cEntity & a_Vehicle) { ASSERT(m_State == 3); // In game mode? @@ -184,7 +183,7 @@ void cProtocol180::SendAttachEntity(const cEntity & a_Entity, const cEntity & a_ -void cProtocol180::SendBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) +void cProtocol_1_8_0::SendBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) { ASSERT(m_State == 3); // In game mode? @@ -199,7 +198,7 @@ void cProtocol180::SendBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, cha -void cProtocol180::SendBlockBreakAnim(UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) +void cProtocol_1_8_0::SendBlockBreakAnim(UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) { ASSERT(m_State == 3); // In game mode? @@ -213,7 +212,7 @@ void cProtocol180::SendBlockBreakAnim(UInt32 a_EntityID, int a_BlockX, int a_Blo -void cProtocol180::SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +void cProtocol_1_8_0::SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) { ASSERT(m_State == 3); // In game mode? @@ -226,7 +225,7 @@ void cProtocol180::SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BLO -void cProtocol180::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) +void cProtocol_1_8_0::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) { ASSERT(m_State == 3); // In game mode? @@ -246,7 +245,7 @@ void cProtocol180::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockV -void cProtocol180::SendCameraSetTo(const cEntity & a_Entity) +void cProtocol_1_8_0::SendCameraSetTo(const cEntity & a_Entity) { cPacketizer Pkt(*this, 0x43); // Camera Packet (Attach the camera of a player at another entity in spectator mode) Pkt.WriteVarInt32(a_Entity.GetUniqueID()); @@ -256,35 +255,29 @@ void cProtocol180::SendCameraSetTo(const cEntity & a_Entity) -void cProtocol180::SendChat(const AString & a_Message, eChatType a_Type) +void cProtocol_1_8_0::SendChat(const AString & a_Message, eChatType a_Type) { ASSERT(m_State == 3); // In game mode? - cPacketizer Pkt(*this, 0x02); // Chat Message packet - Pkt.WriteString(Printf("{\"text\":\"%s\"}", EscapeString(a_Message).c_str())); - Pkt.WriteBEInt8(a_Type); + SendChatRaw(Printf("{\"text\":\"%s\"}", EscapeString(a_Message).c_str()), a_Type); } -void cProtocol180::SendChat(const cCompositeChat & a_Message, eChatType a_Type, bool a_ShouldUseChatPrefixes) +void cProtocol_1_8_0::SendChat(const cCompositeChat & a_Message, eChatType a_Type, bool a_ShouldUseChatPrefixes) { ASSERT(m_State == 3); // In game mode? - - // Send the message to the client: - cPacketizer Pkt(*this, 0x02); - Pkt.WriteString(a_Message.CreateJsonString(a_ShouldUseChatPrefixes)); - Pkt.WriteBEInt8(a_Type); + SendChatRaw(a_Message.CreateJsonString(a_ShouldUseChatPrefixes), a_Type); } -void cProtocol180::SendChatRaw(const AString & a_MessageRaw, eChatType a_Type) +void cProtocol_1_8_0::SendChatRaw(const AString & a_MessageRaw, eChatType a_Type) { ASSERT(m_State == 3); // In game mode? @@ -298,7 +291,7 @@ void cProtocol180::SendChatRaw(const AString & a_MessageRaw, eChatType a_Type) -void cProtocol180::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) +void cProtocol_1_8_0::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) { ASSERT(m_State == 3); // In game mode? @@ -314,8 +307,9 @@ void cProtocol180::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerialize -void cProtocol180::SendCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player) +void cProtocol_1_8_0::SendCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player, int a_Count) { + UNUSED(a_Count); ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, 0x0d); // Collect Item packet @@ -327,7 +321,7 @@ void cProtocol180::SendCollectEntity(const cEntity & a_Entity, const cPlayer & a -void cProtocol180::SendDestroyEntity(const cEntity & a_Entity) +void cProtocol_1_8_0::SendDestroyEntity(const cEntity & a_Entity) { ASSERT(m_State == 3); // In game mode? @@ -340,7 +334,7 @@ void cProtocol180::SendDestroyEntity(const cEntity & a_Entity) -void cProtocol180::SendDetachEntity(const cEntity & a_Entity, const cEntity & a_PreviousVehicle) +void cProtocol_1_8_0::SendDetachEntity(const cEntity & a_Entity, const cEntity & a_PreviousVehicle) { ASSERT(m_State == 3); // In game mode? @@ -354,7 +348,7 @@ void cProtocol180::SendDetachEntity(const cEntity & a_Entity, const cEntity & a_ -void cProtocol180::SendDisconnect(const AString & a_Reason) +void cProtocol_1_8_0::SendDisconnect(const AString & a_Reason) { switch (m_State) { @@ -379,7 +373,7 @@ void cProtocol180::SendDisconnect(const AString & a_Reason) -void cProtocol180::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ) +void cProtocol_1_8_0::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ) { ASSERT(m_State == 3); // In game mode? @@ -391,7 +385,7 @@ void cProtocol180::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ) -void cProtocol180::SendEntityEffect(const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) +void cProtocol_1_8_0::SendEntityEffect(const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) { ASSERT(m_State == 3); // In game mode? @@ -407,7 +401,7 @@ void cProtocol180::SendEntityEffect(const cEntity & a_Entity, int a_EffectID, in -void cProtocol180::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) +void cProtocol_1_8_0::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) { ASSERT(m_State == 3); // In game mode? @@ -421,7 +415,7 @@ void cProtocol180::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum -void cProtocol180::SendEntityHeadLook(const cEntity & a_Entity) +void cProtocol_1_8_0::SendEntityHeadLook(const cEntity & a_Entity) { ASSERT(m_State == 3); // In game mode? @@ -434,7 +428,7 @@ void cProtocol180::SendEntityHeadLook(const cEntity & a_Entity) -void cProtocol180::SendEntityLook(const cEntity & a_Entity) +void cProtocol_1_8_0::SendEntityLook(const cEntity & a_Entity) { ASSERT(m_State == 3); // In game mode? @@ -449,7 +443,7 @@ void cProtocol180::SendEntityLook(const cEntity & a_Entity) -void cProtocol180::SendEntityMetadata(const cEntity & a_Entity) +void cProtocol_1_8_0::SendEntityMetadata(const cEntity & a_Entity) { ASSERT(m_State == 3); // In game mode? @@ -463,7 +457,7 @@ void cProtocol180::SendEntityMetadata(const cEntity & a_Entity) -void cProtocol180::SendEntityProperties(const cEntity & a_Entity) +void cProtocol_1_8_0::SendEntityProperties(const cEntity & a_Entity) { ASSERT(m_State == 3); // In game mode? @@ -476,7 +470,7 @@ void cProtocol180::SendEntityProperties(const cEntity & a_Entity) -void cProtocol180::SendEntityRelMove(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) +void cProtocol_1_8_0::SendEntityRelMove(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) { ASSERT(m_State == 3); // In game mode? @@ -492,7 +486,7 @@ void cProtocol180::SendEntityRelMove(const cEntity & a_Entity, char a_RelX, char -void cProtocol180::SendEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) +void cProtocol_1_8_0::SendEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) { ASSERT(m_State == 3); // In game mode? @@ -510,7 +504,7 @@ void cProtocol180::SendEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, -void cProtocol180::SendEntityStatus(const cEntity & a_Entity, char a_Status) +void cProtocol_1_8_0::SendEntityStatus(const cEntity & a_Entity, char a_Status) { ASSERT(m_State == 3); // In game mode? @@ -523,7 +517,7 @@ void cProtocol180::SendEntityStatus(const cEntity & a_Entity, char a_Status) -void cProtocol180::SendEntityVelocity(const cEntity & a_Entity) +void cProtocol_1_8_0::SendEntityVelocity(const cEntity & a_Entity) { ASSERT(m_State == 3); // In game mode? @@ -539,7 +533,7 @@ void cProtocol180::SendEntityVelocity(const cEntity & a_Entity) -void cProtocol180::SendExplosion(double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) +void cProtocol_1_8_0::SendExplosion(double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) { ASSERT(m_State == 3); // In game mode? @@ -564,7 +558,7 @@ void cProtocol180::SendExplosion(double a_BlockX, double a_BlockY, double a_Bloc -void cProtocol180::SendGameMode(eGameMode a_GameMode) +void cProtocol_1_8_0::SendGameMode(eGameMode a_GameMode) { ASSERT(m_State == 3); // In game mode? @@ -577,7 +571,7 @@ void cProtocol180::SendGameMode(eGameMode a_GameMode) -void cProtocol180::SendHealth(void) +void cProtocol_1_8_0::SendHealth(void) { ASSERT(m_State == 3); // In game mode? @@ -592,7 +586,7 @@ void cProtocol180::SendHealth(void) -void cProtocol180::SendHideTitle(void) +void cProtocol_1_8_0::SendHideTitle(void) { ASSERT(m_State == 3); // In game mode? @@ -604,7 +598,7 @@ void cProtocol180::SendHideTitle(void) -void cProtocol180::SendInventorySlot(char a_WindowID, short a_SlotNum, const cItem & a_Item) +void cProtocol_1_8_0::SendInventorySlot(char a_WindowID, short a_SlotNum, const cItem & a_Item) { ASSERT(m_State == 3); // In game mode? @@ -618,7 +612,7 @@ void cProtocol180::SendInventorySlot(char a_WindowID, short a_SlotNum, const cIt -void cProtocol180::SendKeepAlive(UInt32 a_PingID) +void cProtocol_1_8_0::SendKeepAlive(UInt32 a_PingID) { // Drop the packet if the protocol is not in the Game state yet (caused a client crash): if (m_State != 3) @@ -635,7 +629,7 @@ void cProtocol180::SendKeepAlive(UInt32 a_PingID) -void cProtocol180::SendLogin(const cPlayer & a_Player, const cWorld & a_World) +void cProtocol_1_8_0::SendLogin(const cPlayer & a_Player, const cWorld & a_World) { // Send the Join Game packet: { @@ -669,7 +663,7 @@ void cProtocol180::SendLogin(const cPlayer & a_Player, const cWorld & a_World) -void cProtocol180::SendLoginSuccess(void) +void cProtocol_1_8_0::SendLoginSuccess(void) { ASSERT(m_State == 2); // State: login? @@ -692,7 +686,7 @@ void cProtocol180::SendLoginSuccess(void) -void cProtocol180::SendPaintingSpawn(const cPainting & a_Painting) +void cProtocol_1_8_0::SendPaintingSpawn(const cPainting & a_Painting) { ASSERT(m_State == 3); // In game mode? double PosX = a_Painting.GetPosX(); @@ -710,7 +704,7 @@ void cProtocol180::SendPaintingSpawn(const cPainting & a_Painting) -void cProtocol180::SendMapData(const cMap & a_Map, int a_DataStartX, int a_DataStartY) +void cProtocol_1_8_0::SendMapData(const cMap & a_Map, int a_DataStartX, int a_DataStartY) { ASSERT(m_State == 3); // In game mode? @@ -741,7 +735,7 @@ void cProtocol180::SendMapData(const cMap & a_Map, int a_DataStartX, int a_DataS -void cProtocol180::SendPickupSpawn(const cPickup & a_Pickup) +void cProtocol_1_8_0::SendPickupSpawn(const cPickup & a_Pickup) { ASSERT(m_State == 3); // In game mode? @@ -770,7 +764,7 @@ void cProtocol180::SendPickupSpawn(const cPickup & a_Pickup) -void cProtocol180::SendPlayerAbilities(void) +void cProtocol_1_8_0::SendPlayerAbilities(void) { ASSERT(m_State == 3); // In game mode? @@ -799,7 +793,7 @@ void cProtocol180::SendPlayerAbilities(void) -void cProtocol180::SendEntityAnimation(const cEntity & a_Entity, char a_Animation) +void cProtocol_1_8_0::SendEntityAnimation(const cEntity & a_Entity, char a_Animation) { ASSERT(m_State == 3); // In game mode? @@ -812,7 +806,7 @@ void cProtocol180::SendEntityAnimation(const cEntity & a_Entity, char a_Animatio -void cProtocol180::SendParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) +void cProtocol_1_8_0::SendParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) { ASSERT(m_State == 3); // In game mode? int ParticleID = GetParticleID(a_ParticleName); @@ -834,7 +828,7 @@ void cProtocol180::SendParticleEffect(const AString & a_ParticleName, float a_Sr -void cProtocol180::SendParticleEffect(const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data) +void cProtocol_1_8_0::SendParticleEffect(const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data) { ASSERT(m_State == 3); // In game mode? int ParticleID = GetParticleID(a_ParticleName); @@ -878,7 +872,7 @@ void cProtocol180::SendParticleEffect(const AString & a_ParticleName, Vector3f a -void cProtocol180::SendPlayerListAddPlayer(const cPlayer & a_Player) +void cProtocol_1_8_0::SendPlayerListAddPlayer(const cPlayer & a_Player) { ASSERT(m_State == 3); // In game mode? @@ -915,7 +909,7 @@ void cProtocol180::SendPlayerListAddPlayer(const cPlayer & a_Player) -void cProtocol180::SendPlayerListRemovePlayer(const cPlayer & a_Player) +void cProtocol_1_8_0::SendPlayerListRemovePlayer(const cPlayer & a_Player) { ASSERT(m_State == 3); // In game mode? @@ -929,7 +923,7 @@ void cProtocol180::SendPlayerListRemovePlayer(const cPlayer & a_Player) -void cProtocol180::SendPlayerListUpdateGameMode(const cPlayer & a_Player) +void cProtocol_1_8_0::SendPlayerListUpdateGameMode(const cPlayer & a_Player) { ASSERT(m_State == 3); // In game mode? @@ -944,7 +938,7 @@ void cProtocol180::SendPlayerListUpdateGameMode(const cPlayer & a_Player) -void cProtocol180::SendPlayerListUpdatePing(const cPlayer & a_Player) +void cProtocol_1_8_0::SendPlayerListUpdatePing(const cPlayer & a_Player) { ASSERT(m_State == 3); // In game mode? @@ -963,7 +957,7 @@ void cProtocol180::SendPlayerListUpdatePing(const cPlayer & a_Player) -void cProtocol180::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName) +void cProtocol_1_8_0::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName) { ASSERT(m_State == 3); // In game mode? @@ -987,7 +981,7 @@ void cProtocol180::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, con -void cProtocol180::SendPlayerMaxSpeed(void) +void cProtocol_1_8_0::SendPlayerMaxSpeed(void) { ASSERT(m_State == 3); // In game mode? @@ -1016,7 +1010,7 @@ void cProtocol180::SendPlayerMaxSpeed(void) -void cProtocol180::SendPlayerMoveLook(void) +void cProtocol_1_8_0::SendPlayerMoveLook(void) { ASSERT(m_State == 3); // In game mode? @@ -1034,7 +1028,7 @@ void cProtocol180::SendPlayerMoveLook(void) -void cProtocol180::SendPlayerPosition(void) +void cProtocol_1_8_0::SendPlayerPosition(void) { // There is no dedicated packet for this, send the whole thing: SendPlayerMoveLook(); @@ -1044,7 +1038,7 @@ void cProtocol180::SendPlayerPosition(void) -void cProtocol180::SendPlayerSpawn(const cPlayer & a_Player) +void cProtocol_1_8_0::SendPlayerSpawn(const cPlayer & a_Player) { // Called to spawn another player for the client cPacketizer Pkt(*this, 0x0c); // Spawn Player packet @@ -1068,7 +1062,7 @@ void cProtocol180::SendPlayerSpawn(const cPlayer & a_Player) -void cProtocol180::SendPluginMessage(const AString & a_Channel, const AString & a_Message) +void cProtocol_1_8_0::SendPluginMessage(const AString & a_Channel, const AString & a_Message) { ASSERT(m_State == 3); // In game mode? @@ -1081,7 +1075,7 @@ void cProtocol180::SendPluginMessage(const AString & a_Channel, const AString & -void cProtocol180::SendRemoveEntityEffect(const cEntity & a_Entity, int a_EffectID) +void cProtocol_1_8_0::SendRemoveEntityEffect(const cEntity & a_Entity, int a_EffectID) { ASSERT(m_State == 3); // In game mode? @@ -1094,7 +1088,7 @@ void cProtocol180::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effect -void cProtocol180::SendResetTitle(void) +void cProtocol_1_8_0::SendResetTitle(void) { ASSERT(m_State == 3); // In game mode? @@ -1106,7 +1100,7 @@ void cProtocol180::SendResetTitle(void) -void cProtocol180::SendRespawn(eDimension a_Dimension) +void cProtocol_1_8_0::SendRespawn(eDimension a_Dimension) { cPacketizer Pkt(*this, 0x07); // Respawn packet @@ -1121,7 +1115,7 @@ void cProtocol180::SendRespawn(eDimension a_Dimension) -void cProtocol180::SendExperience(void) +void cProtocol_1_8_0::SendExperience(void) { ASSERT(m_State == 3); // In game mode? @@ -1136,7 +1130,7 @@ void cProtocol180::SendExperience(void) -void cProtocol180::SendExperienceOrb(const cExpOrb & a_ExpOrb) +void cProtocol_1_8_0::SendExperienceOrb(const cExpOrb & a_ExpOrb) { ASSERT(m_State == 3); // In game mode? @@ -1152,7 +1146,7 @@ void cProtocol180::SendExperienceOrb(const cExpOrb & a_ExpOrb) -void cProtocol180::SendScoreboardObjective(const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) +void cProtocol_1_8_0::SendScoreboardObjective(const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) { ASSERT(m_State == 3); // In game mode? @@ -1170,7 +1164,7 @@ void cProtocol180::SendScoreboardObjective(const AString & a_Name, const AString -void cProtocol180::SendScoreUpdate(const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) +void cProtocol_1_8_0::SendScoreUpdate(const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) { ASSERT(m_State == 3); // In game mode? @@ -1189,7 +1183,7 @@ void cProtocol180::SendScoreUpdate(const AString & a_Objective, const AString & -void cProtocol180::SendDisplayObjective(const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) +void cProtocol_1_8_0::SendDisplayObjective(const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) { ASSERT(m_State == 3); // In game mode? @@ -1202,7 +1196,7 @@ void cProtocol180::SendDisplayObjective(const AString & a_Objective, cScoreboard -void cProtocol180::SendSetSubTitle(const cCompositeChat & a_SubTitle) +void cProtocol_1_8_0::SendSetSubTitle(const cCompositeChat & a_SubTitle) { SendSetRawSubTitle(a_SubTitle.CreateJsonString(false)); } @@ -1211,7 +1205,7 @@ void cProtocol180::SendSetSubTitle(const cCompositeChat & a_SubTitle) -void cProtocol180::SendSetRawSubTitle(const AString & a_SubTitle) +void cProtocol_1_8_0::SendSetRawSubTitle(const AString & a_SubTitle) { ASSERT(m_State == 3); // In game mode? @@ -1225,7 +1219,7 @@ void cProtocol180::SendSetRawSubTitle(const AString & a_SubTitle) -void cProtocol180::SendSetTitle(const cCompositeChat & a_Title) +void cProtocol_1_8_0::SendSetTitle(const cCompositeChat & a_Title) { SendSetRawTitle(a_Title.CreateJsonString(false)); } @@ -1234,7 +1228,7 @@ void cProtocol180::SendSetTitle(const cCompositeChat & a_Title) -void cProtocol180::SendSetRawTitle(const AString & a_Title) +void cProtocol_1_8_0::SendSetRawTitle(const AString & a_Title) { ASSERT(m_State == 3); // In game mode? @@ -1248,7 +1242,7 @@ void cProtocol180::SendSetRawTitle(const AString & a_Title) -void cProtocol180::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) +void cProtocol_1_8_0::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) { ASSERT(m_State == 3); // In game mode? @@ -1265,7 +1259,7 @@ void cProtocol180::SendSoundEffect(const AString & a_SoundName, double a_X, doub -void cProtocol180::SendSoundParticleEffect(const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) +void cProtocol_1_8_0::SendSoundParticleEffect(const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) { ASSERT(m_State == 3); // In game mode? @@ -1280,7 +1274,7 @@ void cProtocol180::SendSoundParticleEffect(const EffectID a_EffectID, int a_SrcX -void cProtocol180::SendSpawnFallingBlock(const cFallingBlock & a_FallingBlock) +void cProtocol_1_8_0::SendSpawnFallingBlock(const cFallingBlock & a_FallingBlock) { ASSERT(m_State == 3); // In game mode? @@ -1302,7 +1296,7 @@ void cProtocol180::SendSpawnFallingBlock(const cFallingBlock & a_FallingBlock) -void cProtocol180::SendSpawnMob(const cMonster & a_Mob) +void cProtocol_1_8_0::SendSpawnMob(const cMonster & a_Mob) { ASSERT(m_State == 3); // In game mode? @@ -1326,7 +1320,7 @@ void cProtocol180::SendSpawnMob(const cMonster & a_Mob) -void cProtocol180::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) +void cProtocol_1_8_0::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) { ASSERT(m_State == 3); // In game mode? double PosX = a_Entity.GetPosX(); @@ -1358,7 +1352,7 @@ void cProtocol180::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, -void cProtocol180::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) +void cProtocol_1_8_0::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) { ASSERT(m_State == 3); // In game mode? @@ -1383,7 +1377,7 @@ void cProtocol180::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleTyp -void cProtocol180::SendStatistics(const cStatManager & a_Manager) +void cProtocol_1_8_0::SendStatistics(const cStatManager & a_Manager) { ASSERT(m_State == 3); // In game mode? @@ -1405,7 +1399,7 @@ void cProtocol180::SendStatistics(const cStatManager & a_Manager) -void cProtocol180::SendTabCompletionResults(const AStringVector & a_Results) +void cProtocol_1_8_0::SendTabCompletionResults(const AStringVector & a_Results) { ASSERT(m_State == 3); // In game mode? @@ -1422,7 +1416,7 @@ void cProtocol180::SendTabCompletionResults(const AStringVector & a_Results) -void cProtocol180::SendTeleportEntity(const cEntity & a_Entity) +void cProtocol_1_8_0::SendTeleportEntity(const cEntity & a_Entity) { ASSERT(m_State == 3); // In game mode? @@ -1440,7 +1434,7 @@ void cProtocol180::SendTeleportEntity(const cEntity & a_Entity) -void cProtocol180::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ) +void cProtocol_1_8_0::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ) { ASSERT(m_State == 3); // In game mode? @@ -1456,7 +1450,7 @@ void cProtocol180::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ) -void cProtocol180::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) +void cProtocol_1_8_0::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) { ASSERT(m_State == 3); // In game mode? @@ -1472,7 +1466,7 @@ void cProtocol180::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_F -void cProtocol180::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) +void cProtocol_1_8_0::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) { ASSERT(m_State == 3); // In game mode? if (!a_DoDaylightCycle) @@ -1490,7 +1484,7 @@ void cProtocol180::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_Do -void cProtocol180::SendUnloadChunk(int a_ChunkX, int a_ChunkZ) +void cProtocol_1_8_0::SendUnloadChunk(int a_ChunkX, int a_ChunkZ) { ASSERT(m_State == 3); // In game mode? @@ -1505,7 +1499,7 @@ void cProtocol180::SendUnloadChunk(int a_ChunkX, int a_ChunkZ) -void cProtocol180::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity) +void cProtocol_1_8_0::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity) { ASSERT(m_State == 3); // In game mode? @@ -1531,7 +1525,7 @@ void cProtocol180::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity) -void cProtocol180::SendUpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) +void cProtocol_1_8_0::SendUpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) { ASSERT(m_State == 3); // In game mode? @@ -1552,7 +1546,7 @@ void cProtocol180::SendUpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, cons -void cProtocol180::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) +void cProtocol_1_8_0::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) { ASSERT(m_State == 3); // In game mode? @@ -1565,7 +1559,7 @@ void cProtocol180::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_Bloc -void cProtocol180::SendWeather(eWeather a_Weather) +void cProtocol_1_8_0::SendWeather(eWeather a_Weather) { ASSERT(m_State == 3); // In game mode? @@ -1582,7 +1576,7 @@ void cProtocol180::SendWeather(eWeather a_Weather) -void cProtocol180::SendWholeInventory(const cWindow & a_Window) +void cProtocol_1_8_0::SendWholeInventory(const cWindow & a_Window) { ASSERT(m_State == 3); // In game mode? @@ -1601,7 +1595,7 @@ void cProtocol180::SendWholeInventory(const cWindow & a_Window) -void cProtocol180::SendWindowClose(const cWindow & a_Window) +void cProtocol_1_8_0::SendWindowClose(const cWindow & a_Window) { ASSERT(m_State == 3); // In game mode? @@ -1613,7 +1607,7 @@ void cProtocol180::SendWindowClose(const cWindow & a_Window) -void cProtocol180::SendWindowOpen(const cWindow & a_Window) +void cProtocol_1_8_0::SendWindowOpen(const cWindow & a_Window) { ASSERT(m_State == 3); // In game mode? @@ -1654,7 +1648,7 @@ void cProtocol180::SendWindowOpen(const cWindow & a_Window) -void cProtocol180::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value) +void cProtocol_1_8_0::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value) { ASSERT(m_State == 3); // In game mode? @@ -1668,7 +1662,7 @@ void cProtocol180::SendWindowProperty(const cWindow & a_Window, short a_Property -bool cProtocol180::CompressPacket(const AString & a_Packet, AString & a_CompressedData) +bool cProtocol_1_8_0::CompressPacket(const AString & a_Packet, AString & a_CompressedData) { // Compress the data: char CompressedData[MAX_COMPRESSED_PACKET_LEN]; @@ -1711,7 +1705,7 @@ bool cProtocol180::CompressPacket(const AString & a_Packet, AString & a_Compress -int cProtocol180::GetParticleID(const AString & a_ParticleName) +int cProtocol_1_8_0::GetParticleID(const AString & a_ParticleName) { static bool IsInitialized = false; static std::map<AString, int> ParticleMap; @@ -1777,7 +1771,7 @@ int cProtocol180::GetParticleID(const AString & a_ParticleName) -void cProtocol180::FixItemFramePositions(int a_ObjectData, double & a_PosX, double & a_PosZ, double & a_Yaw) +void cProtocol_1_8_0::FixItemFramePositions(int a_ObjectData, double & a_PosX, double & a_PosZ, double & a_Yaw) { switch (a_ObjectData) { @@ -1812,7 +1806,7 @@ void cProtocol180::FixItemFramePositions(int a_ObjectData, double & a_PosX, doub -void cProtocol180::AddReceivedData(const char * a_Data, size_t a_Size) +void cProtocol_1_8_0::AddReceivedData(const char * a_Data, size_t a_Size) { // Write the incoming data into the comm log file: if (g_ShouldLogCommIn && m_CommLogFile.IsOpen()) @@ -2007,7 +2001,7 @@ void cProtocol180::AddReceivedData(const char * a_Data, size_t a_Size) -bool cProtocol180::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) +bool cProtocol_1_8_0::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) { switch (m_State) { @@ -2094,7 +2088,7 @@ bool cProtocol180::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) -void cProtocol180::HandlePacketStatusPing(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketStatusPing(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEInt64, Int64, Timestamp); @@ -2106,7 +2100,7 @@ void cProtocol180::HandlePacketStatusPing(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) { cServer * Server = cRoot::Get()->GetServer(); AString ServerDescription = Server->GetDescription(); @@ -2151,7 +2145,7 @@ void cProtocol180::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketLoginEncryptionResponse(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketLoginEncryptionResponse(cByteBuffer & a_ByteBuffer) { UInt32 EncKeyLength, EncNonceLength; if (!a_ByteBuffer.ReadVarInt(EncKeyLength)) @@ -2214,7 +2208,7 @@ void cProtocol180::HandlePacketLoginEncryptionResponse(cByteBuffer & a_ByteBuffe -void cProtocol180::HandlePacketLoginStart(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketLoginStart(cByteBuffer & a_ByteBuffer) { AString Username; if (!a_ByteBuffer.ReadVarUTF8String(Username)) @@ -2251,7 +2245,7 @@ void cProtocol180::HandlePacketLoginStart(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketAnimation(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketAnimation(cByteBuffer & a_ByteBuffer) { m_Client->HandleAnimation(0); // Packet exists solely for arm-swing notification } @@ -2260,7 +2254,7 @@ void cProtocol180::HandlePacketAnimation(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketBlockDig(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketBlockDig(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, Status); @@ -2278,7 +2272,7 @@ void cProtocol180::HandlePacketBlockDig(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketBlockPlace(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketBlockPlace(cByteBuffer & a_ByteBuffer) { int BlockX, BlockY, BlockZ; if (!a_ByteBuffer.ReadPosition64(BlockX, BlockY, BlockZ)) @@ -2301,7 +2295,7 @@ void cProtocol180::HandlePacketBlockPlace(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketChatMessage(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketChatMessage(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Message); m_Client->HandleChat(Message); @@ -2311,7 +2305,7 @@ void cProtocol180::HandlePacketChatMessage(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketClientSettings(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketClientSettings(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Locale); HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, ViewDistance); @@ -2328,7 +2322,7 @@ void cProtocol180::HandlePacketClientSettings(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketClientStatus(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketClientStatus(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, ActionID); switch (ActionID) @@ -2360,7 +2354,7 @@ void cProtocol180::HandlePacketClientStatus(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketCreativeInventoryAction(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketCreativeInventoryAction(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEInt16, Int16, SlotNum); cItem Item; @@ -2375,7 +2369,7 @@ void cProtocol180::HandlePacketCreativeInventoryAction(cByteBuffer & a_ByteBuffe -void cProtocol180::HandlePacketEntityAction(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketEntityAction(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarInt, UInt32, PlayerID); HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, Action); @@ -2395,7 +2389,7 @@ void cProtocol180::HandlePacketEntityAction(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketKeepAlive(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketKeepAlive(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarInt, UInt32, KeepAliveID); m_Client->HandleKeepAlive(KeepAliveID); @@ -2405,7 +2399,7 @@ void cProtocol180::HandlePacketKeepAlive(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketPlayer(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketPlayer(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBool, bool, IsOnGround); // TODO: m_Client->HandlePlayerOnGround(IsOnGround); @@ -2415,7 +2409,7 @@ void cProtocol180::HandlePacketPlayer(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketPlayerAbilities(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketPlayerAbilities(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, Flags); HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, FlyingSpeed); @@ -2439,7 +2433,7 @@ void cProtocol180::HandlePacketPlayerAbilities(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketPlayerLook(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketPlayerLook(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, Yaw); HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, Pitch); @@ -2451,7 +2445,7 @@ void cProtocol180::HandlePacketPlayerLook(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketPlayerPos(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketPlayerPos(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEDouble, double, PosX); HANDLE_READ(a_ByteBuffer, ReadBEDouble, double, PosY); @@ -2464,7 +2458,7 @@ void cProtocol180::HandlePacketPlayerPos(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketPlayerPosLook(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketPlayerPosLook(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEDouble, double, PosX); HANDLE_READ(a_ByteBuffer, ReadBEDouble, double, PosY); @@ -2479,7 +2473,7 @@ void cProtocol180::HandlePacketPlayerPosLook(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Channel); @@ -2510,7 +2504,7 @@ void cProtocol180::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketSlotSelect(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketSlotSelect(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEInt16, Int16, SlotNum); m_Client->HandleSlotSelected(SlotNum); @@ -2520,7 +2514,7 @@ void cProtocol180::HandlePacketSlotSelect(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketSpectate(cByteBuffer &a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketSpectate(cByteBuffer &a_ByteBuffer) { AString playerUUID; if (!a_ByteBuffer.ReadUUID(playerUUID)) @@ -2535,7 +2529,7 @@ void cProtocol180::HandlePacketSpectate(cByteBuffer &a_ByteBuffer) -void cProtocol180::HandlePacketSteerVehicle(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketSteerVehicle(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, Sideways); HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, Forward); @@ -2559,7 +2553,7 @@ void cProtocol180::HandlePacketSteerVehicle(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketTabComplete(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketTabComplete(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Text); HANDLE_READ(a_ByteBuffer, ReadBool, bool, HasPosition); @@ -2576,7 +2570,7 @@ void cProtocol180::HandlePacketTabComplete(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketUpdateSign(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketUpdateSign(cByteBuffer & a_ByteBuffer) { int BlockX, BlockY, BlockZ; if (!a_ByteBuffer.ReadPosition64(BlockX, BlockY, BlockZ)) @@ -2603,7 +2597,7 @@ void cProtocol180::HandlePacketUpdateSign(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketUseEntity(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketUseEntity(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarInt, UInt32, EntityID); HANDLE_READ(a_ByteBuffer, ReadVarInt, UInt32, Type); @@ -2641,7 +2635,7 @@ void cProtocol180::HandlePacketUseEntity(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketEnchantItem(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketEnchantItem(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, WindowID); HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, Enchantment); @@ -2653,7 +2647,7 @@ void cProtocol180::HandlePacketEnchantItem(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketWindowClick(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketWindowClick(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, WindowID); HANDLE_READ(a_ByteBuffer, ReadBEInt16, Int16, SlotNum); @@ -2705,7 +2699,7 @@ void cProtocol180::HandlePacketWindowClick(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandlePacketWindowClose(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketWindowClose(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, WindowID); m_Client->HandleWindowClose(WindowID); @@ -2715,7 +2709,7 @@ void cProtocol180::HandlePacketWindowClose(cByteBuffer & a_ByteBuffer) -void cProtocol180::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, const AString & a_Channel) +void cProtocol_1_8_0::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, const AString & a_Channel) { if (a_Channel == "MC|AdvCdm") { @@ -2780,7 +2774,7 @@ void cProtocol180::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, const -void cProtocol180::SendData(const char * a_Data, size_t a_Size) +void cProtocol_1_8_0::SendData(const char * a_Data, size_t a_Size) { if (m_IsEncrypted) { @@ -2804,7 +2798,7 @@ void cProtocol180::SendData(const char * a_Data, size_t a_Size) -bool cProtocol180::ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item, size_t a_KeepRemainingBytes) +bool cProtocol_1_8_0::ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item, size_t a_KeepRemainingBytes) { HANDLE_PACKET_READ(a_ByteBuffer, ReadBEInt16, Int16, ItemType); if (ItemType == -1) @@ -2839,7 +2833,7 @@ bool cProtocol180::ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item, size_t a -void cProtocol180::ParseItemMetadata(cItem & a_Item, const AString & a_Metadata) +void cProtocol_1_8_0::ParseItemMetadata(cItem & a_Item, const AString & a_Metadata) { // Parse into NBT: cParsedNBT NBT(a_Metadata.data(), a_Metadata.size()); @@ -2914,7 +2908,7 @@ void cProtocol180::ParseItemMetadata(cItem & a_Item, const AString & a_Metadata) -void cProtocol180::StartEncryption(const Byte * a_Key) +void cProtocol_1_8_0::StartEncryption(const Byte * a_Key) { m_Encryptor.Init(a_Key, a_Key); m_Decryptor.Init(a_Key, a_Key); @@ -2936,7 +2930,7 @@ void cProtocol180::StartEncryption(const Byte * a_Key) -eBlockFace cProtocol180::FaceIntToBlockFace(Int8 a_BlockFace) +eBlockFace cProtocol_1_8_0::FaceIntToBlockFace(Int8 a_BlockFace) { // Normalize the blockface values returned from the protocol // Anything known gets mapped 1:1, everything else returns BLOCK_FACE_NONE @@ -2957,9 +2951,9 @@ eBlockFace cProtocol180::FaceIntToBlockFace(Int8 a_BlockFace) //////////////////////////////////////////////////////////////////////////////// -// cProtocol180::cPacketizer: +// cProtocol_1_8_0::cPacketizer: -void cProtocol180::SendPacket(cPacketizer & a_Pkt) +void cProtocol_1_8_0::SendPacket(cPacketizer & a_Pkt) { UInt32 PacketLen = static_cast<UInt32>(m_OutPacketBuffer.GetUsedSpace()); AString PacketData, CompressedPacket; @@ -2969,7 +2963,7 @@ void cProtocol180::SendPacket(cPacketizer & a_Pkt) if ((m_State == 3) && (PacketLen >= 256)) { // Compress the packet payload: - if (!cProtocol180::CompressPacket(PacketData, CompressedPacket)) + if (!cProtocol_1_8_0::CompressPacket(PacketData, CompressedPacket)) { return; } @@ -3019,7 +3013,7 @@ void cProtocol180::SendPacket(cPacketizer & a_Pkt) -void cProtocol180::WriteItem(cPacketizer & a_Pkt, const cItem & a_Item) +void cProtocol_1_8_0::WriteItem(cPacketizer & a_Pkt, const cItem & a_Item) { short ItemType = a_Item.m_ItemType; ASSERT(ItemType >= -1); // Check validity of packets in debug runtime @@ -3107,7 +3101,7 @@ void cProtocol180::WriteItem(cPacketizer & a_Pkt, const cItem & a_Item) -void cProtocol180::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity & a_BlockEntity) +void cProtocol_1_8_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity & a_BlockEntity) { cFastNBTWriter Writer; @@ -3211,7 +3205,7 @@ void cProtocol180::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity & a_ -void cProtocol180::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_Entity) +void cProtocol_1_8_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_Entity) { // Common metadata: Byte Flags = 0; @@ -3341,7 +3335,7 @@ void cProtocol180::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_En -void cProtocol180::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob) +void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob) { // Living Enitiy Metadata if (a_Mob.HasCustomName()) @@ -3609,7 +3603,7 @@ void cProtocol180::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob) -void cProtocol180::WriteEntityProperties(cPacketizer & a_Pkt, const cEntity & a_Entity) +void cProtocol_1_8_0::WriteEntityProperties(cPacketizer & a_Pkt, const cEntity & a_Entity) { if (!a_Entity.IsMob()) { diff --git a/src/Protocol/Protocol18x.h b/src/Protocol/Protocol_1_8.h index 71bc95ef8..564443a38 100644 --- a/src/Protocol/Protocol18x.h +++ b/src/Protocol/Protocol_1_8.h @@ -1,11 +1,10 @@ -// Protocol18x.h +// Protocol_1_8.h /* -Declares the 1.8.x protocol classes: - - cProtocol180 - - release 1.8.0 protocol (#47) -(others may be added later in the future for the 1.8 release series) +Declares the 1.8 protocol classes: + - cProtocol_1_8_0 + - release 1.8 protocol (#47) */ @@ -47,14 +46,14 @@ namespace Json -class cProtocol180 : +class cProtocol_1_8_0 : public cProtocol { typedef cProtocol super; public: - cProtocol180(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State); + cProtocol_1_8_0(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State); /** Called when client sends some data: */ virtual void DataReceived(const char * a_Data, size_t a_Size) override; @@ -70,7 +69,7 @@ public: virtual void SendChat (const cCompositeChat & a_Message, eChatType a_Type, bool a_ShouldUseChatPrefixes) override; virtual void SendChatRaw (const AString & a_MessageRaw, eChatType a_Type) override; virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override; - virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) override; + virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player, int a_Count) override; virtual void SendDestroyEntity (const cEntity & a_Entity) override; virtual void SendDetachEntity (const cEntity & a_Entity, const cEntity & a_PreviousVehicle) override; virtual void SendDisconnect (const AString & a_Reason) override; diff --git a/src/Protocol/Protocol19x.cpp b/src/Protocol/Protocol_1_9.cpp index 5f3b9ec27..680675ca3 100644 --- a/src/Protocol/Protocol19x.cpp +++ b/src/Protocol/Protocol_1_9.cpp @@ -1,22 +1,21 @@ -// Protocol19x.cpp +// Protocol_1_9.cpp /* -Implements the 1.9.x protocol classes: - - cProtocol190 - - release 1.9.0 protocol (#107) - - cProtocol191 +Implements the 1.9 protocol classes: + - cProtocol_1_9_0 + - release 1.9 protocol (#107) + - cProtocol_1_9_1 - release 1.9.1 protocol (#108) - - cProtocol192 + - cProtocol_1_9_2 - release 1.9.2 protocol (#109) - - cProtocol194 + - cProtocol_1_9_4 - release 1.9.4 protocol (#110) -(others may be added later in the future for the 1.9 release series) */ #include "Globals.h" #include "json/json.h" -#include "Protocol19x.h" +#include "Protocol_1_9.h" #include "ChunkDataSerializer.h" #include "PolarSSL++/Sha1Checksum.h" #include "Packetizer.h" @@ -109,9 +108,9 @@ extern bool g_ShouldLogCommIn, g_ShouldLogCommOut; //////////////////////////////////////////////////////////////////////////////// -// cProtocol190: +// cProtocol_1_9_0: -cProtocol190::cProtocol190(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) : +cProtocol_1_9_0::cProtocol_1_9_0(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) : super(a_Client), m_ServerAddress(a_ServerAddress), m_ServerPort(a_ServerPort), @@ -156,7 +155,7 @@ cProtocol190::cProtocol190(cClientHandle * a_Client, const AString & a_ServerAdd -void cProtocol190::DataReceived(const char * a_Data, size_t a_Size) +void cProtocol_1_9_0::DataReceived(const char * a_Data, size_t a_Size) { if (m_IsEncrypted) { @@ -180,7 +179,7 @@ void cProtocol190::DataReceived(const char * a_Data, size_t a_Size) -void cProtocol190::SendAttachEntity(const cEntity & a_Entity, const cEntity & a_Vehicle) +void cProtocol_1_9_0::SendAttachEntity(const cEntity & a_Entity, const cEntity & a_Vehicle) { ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, 0x40); // Set passangers packet @@ -193,7 +192,7 @@ void cProtocol190::SendAttachEntity(const cEntity & a_Entity, const cEntity & a_ -void cProtocol190::SendBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) +void cProtocol_1_9_0::SendBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) { ASSERT(m_State == 3); // In game mode? @@ -208,7 +207,7 @@ void cProtocol190::SendBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, cha -void cProtocol190::SendBlockBreakAnim(UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) +void cProtocol_1_9_0::SendBlockBreakAnim(UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) { ASSERT(m_State == 3); // In game mode? @@ -222,7 +221,7 @@ void cProtocol190::SendBlockBreakAnim(UInt32 a_EntityID, int a_BlockX, int a_Blo -void cProtocol190::SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +void cProtocol_1_9_0::SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) { ASSERT(m_State == 3); // In game mode? @@ -235,7 +234,7 @@ void cProtocol190::SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BLO -void cProtocol190::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) +void cProtocol_1_9_0::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) { ASSERT(m_State == 3); // In game mode? @@ -255,7 +254,7 @@ void cProtocol190::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockV -void cProtocol190::SendCameraSetTo(const cEntity & a_Entity) +void cProtocol_1_9_0::SendCameraSetTo(const cEntity & a_Entity) { cPacketizer Pkt(*this, 0x36); // Camera Packet (Attach the camera of a player at another entity in spectator mode) Pkt.WriteVarInt32(a_Entity.GetUniqueID()); @@ -265,35 +264,29 @@ void cProtocol190::SendCameraSetTo(const cEntity & a_Entity) -void cProtocol190::SendChat(const AString & a_Message, eChatType a_Type) +void cProtocol_1_9_0::SendChat(const AString & a_Message, eChatType a_Type) { ASSERT(m_State == 3); // In game mode? - cPacketizer Pkt(*this, 0x0f); // Chat Message packet - Pkt.WriteString(Printf("{\"text\":\"%s\"}", EscapeString(a_Message).c_str())); - Pkt.WriteBEInt8(a_Type); + SendChatRaw(Printf("{\"text\":\"%s\"}", EscapeString(a_Message).c_str()), a_Type); } -void cProtocol190::SendChat(const cCompositeChat & a_Message, eChatType a_Type, bool a_ShouldUseChatPrefixes) +void cProtocol_1_9_0::SendChat(const cCompositeChat & a_Message, eChatType a_Type, bool a_ShouldUseChatPrefixes) { ASSERT(m_State == 3); // In game mode? - - // Send the message to the client: - cPacketizer Pkt(*this, 0x0f); // Chat Message packet - Pkt.WriteString(a_Message.CreateJsonString(a_ShouldUseChatPrefixes)); - Pkt.WriteBEInt8(a_Type); + SendChatRaw(a_Message.CreateJsonString(a_ShouldUseChatPrefixes), a_Type); } -void cProtocol190::SendChatRaw(const AString & a_MessageRaw, eChatType a_Type) +void cProtocol_1_9_0::SendChatRaw(const AString & a_MessageRaw, eChatType a_Type) { ASSERT(m_State == 3); // In game mode? @@ -307,7 +300,7 @@ void cProtocol190::SendChatRaw(const AString & a_MessageRaw, eChatType a_Type) -void cProtocol190::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) +void cProtocol_1_9_0::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) { ASSERT(m_State == 3); // In game mode? @@ -323,8 +316,9 @@ void cProtocol190::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerialize -void cProtocol190::SendCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player) +void cProtocol_1_9_0::SendCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player, int a_Count) { + UNUSED(a_Count); ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, 0x49); // Collect Item packet @@ -336,7 +330,7 @@ void cProtocol190::SendCollectEntity(const cEntity & a_Entity, const cPlayer & a -void cProtocol190::SendDestroyEntity(const cEntity & a_Entity) +void cProtocol_1_9_0::SendDestroyEntity(const cEntity & a_Entity) { ASSERT(m_State == 3); // In game mode? @@ -349,7 +343,7 @@ void cProtocol190::SendDestroyEntity(const cEntity & a_Entity) -void cProtocol190::SendDetachEntity(const cEntity & a_Entity, const cEntity & a_PreviousVehicle) +void cProtocol_1_9_0::SendDetachEntity(const cEntity & a_Entity, const cEntity & a_PreviousVehicle) { ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, 0x40); // Set passangers packet @@ -361,7 +355,7 @@ void cProtocol190::SendDetachEntity(const cEntity & a_Entity, const cEntity & a_ -void cProtocol190::SendDisconnect(const AString & a_Reason) +void cProtocol_1_9_0::SendDisconnect(const AString & a_Reason) { switch (m_State) { @@ -386,7 +380,7 @@ void cProtocol190::SendDisconnect(const AString & a_Reason) -void cProtocol190::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ) +void cProtocol_1_9_0::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ) { ASSERT(m_State == 3); // In game mode? @@ -398,7 +392,7 @@ void cProtocol190::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ) -void cProtocol190::SendEntityEffect(const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) +void cProtocol_1_9_0::SendEntityEffect(const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) { ASSERT(m_State == 3); // In game mode? @@ -414,7 +408,7 @@ void cProtocol190::SendEntityEffect(const cEntity & a_Entity, int a_EffectID, in -void cProtocol190::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) +void cProtocol_1_9_0::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) { ASSERT(m_State == 3); // In game mode? @@ -433,7 +427,7 @@ void cProtocol190::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum -void cProtocol190::SendEntityHeadLook(const cEntity & a_Entity) +void cProtocol_1_9_0::SendEntityHeadLook(const cEntity & a_Entity) { ASSERT(m_State == 3); // In game mode? @@ -446,7 +440,7 @@ void cProtocol190::SendEntityHeadLook(const cEntity & a_Entity) -void cProtocol190::SendEntityLook(const cEntity & a_Entity) +void cProtocol_1_9_0::SendEntityLook(const cEntity & a_Entity) { ASSERT(m_State == 3); // In game mode? @@ -461,7 +455,7 @@ void cProtocol190::SendEntityLook(const cEntity & a_Entity) -void cProtocol190::SendEntityMetadata(const cEntity & a_Entity) +void cProtocol_1_9_0::SendEntityMetadata(const cEntity & a_Entity) { ASSERT(m_State == 3); // In game mode? @@ -475,7 +469,7 @@ void cProtocol190::SendEntityMetadata(const cEntity & a_Entity) -void cProtocol190::SendEntityProperties(const cEntity & a_Entity) +void cProtocol_1_9_0::SendEntityProperties(const cEntity & a_Entity) { ASSERT(m_State == 3); // In game mode? @@ -488,7 +482,7 @@ void cProtocol190::SendEntityProperties(const cEntity & a_Entity) -void cProtocol190::SendEntityRelMove(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) +void cProtocol_1_9_0::SendEntityRelMove(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) { ASSERT(m_State == 3); // In game mode? @@ -505,7 +499,7 @@ void cProtocol190::SendEntityRelMove(const cEntity & a_Entity, char a_RelX, char -void cProtocol190::SendEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) +void cProtocol_1_9_0::SendEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) { ASSERT(m_State == 3); // In game mode? @@ -524,7 +518,7 @@ void cProtocol190::SendEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, -void cProtocol190::SendEntityStatus(const cEntity & a_Entity, char a_Status) +void cProtocol_1_9_0::SendEntityStatus(const cEntity & a_Entity, char a_Status) { ASSERT(m_State == 3); // In game mode? @@ -537,7 +531,7 @@ void cProtocol190::SendEntityStatus(const cEntity & a_Entity, char a_Status) -void cProtocol190::SendEntityVelocity(const cEntity & a_Entity) +void cProtocol_1_9_0::SendEntityVelocity(const cEntity & a_Entity) { ASSERT(m_State == 3); // In game mode? @@ -553,7 +547,7 @@ void cProtocol190::SendEntityVelocity(const cEntity & a_Entity) -void cProtocol190::SendExplosion(double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) +void cProtocol_1_9_0::SendExplosion(double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) { ASSERT(m_State == 3); // In game mode? @@ -578,7 +572,7 @@ void cProtocol190::SendExplosion(double a_BlockX, double a_BlockY, double a_Bloc -void cProtocol190::SendGameMode(eGameMode a_GameMode) +void cProtocol_1_9_0::SendGameMode(eGameMode a_GameMode) { ASSERT(m_State == 3); // In game mode? @@ -591,7 +585,7 @@ void cProtocol190::SendGameMode(eGameMode a_GameMode) -void cProtocol190::SendHealth(void) +void cProtocol_1_9_0::SendHealth(void) { ASSERT(m_State == 3); // In game mode? @@ -606,7 +600,7 @@ void cProtocol190::SendHealth(void) -void cProtocol190::SendHideTitle(void) +void cProtocol_1_9_0::SendHideTitle(void) { ASSERT(m_State == 3); // In game mode? @@ -618,7 +612,7 @@ void cProtocol190::SendHideTitle(void) -void cProtocol190::SendInventorySlot(char a_WindowID, short a_SlotNum, const cItem & a_Item) +void cProtocol_1_9_0::SendInventorySlot(char a_WindowID, short a_SlotNum, const cItem & a_Item) { ASSERT(m_State == 3); // In game mode? @@ -632,7 +626,7 @@ void cProtocol190::SendInventorySlot(char a_WindowID, short a_SlotNum, const cIt -void cProtocol190::SendKeepAlive(UInt32 a_PingID) +void cProtocol_1_9_0::SendKeepAlive(UInt32 a_PingID) { // Drop the packet if the protocol is not in the Game state yet (caused a client crash): if (m_State != 3) @@ -649,7 +643,7 @@ void cProtocol190::SendKeepAlive(UInt32 a_PingID) -void cProtocol190::SendLogin(const cPlayer & a_Player, const cWorld & a_World) +void cProtocol_1_9_0::SendLogin(const cPlayer & a_Player, const cWorld & a_World) { // Send the Join Game packet: { @@ -683,7 +677,7 @@ void cProtocol190::SendLogin(const cPlayer & a_Player, const cWorld & a_World) -void cProtocol190::SendLoginSuccess(void) +void cProtocol_1_9_0::SendLoginSuccess(void) { ASSERT(m_State == 2); // State: login? @@ -706,7 +700,7 @@ void cProtocol190::SendLoginSuccess(void) -void cProtocol190::SendPaintingSpawn(const cPainting & a_Painting) +void cProtocol_1_9_0::SendPaintingSpawn(const cPainting & a_Painting) { ASSERT(m_State == 3); // In game mode? double PosX = a_Painting.GetPosX(); @@ -727,7 +721,7 @@ void cProtocol190::SendPaintingSpawn(const cPainting & a_Painting) -void cProtocol190::SendMapData(const cMap & a_Map, int a_DataStartX, int a_DataStartY) +void cProtocol_1_9_0::SendMapData(const cMap & a_Map, int a_DataStartX, int a_DataStartY) { ASSERT(m_State == 3); // In game mode? @@ -759,7 +753,7 @@ void cProtocol190::SendMapData(const cMap & a_Map, int a_DataStartX, int a_DataS -void cProtocol190::SendPickupSpawn(const cPickup & a_Pickup) +void cProtocol_1_9_0::SendPickupSpawn(const cPickup & a_Pickup) { ASSERT(m_State == 3); // In game mode? @@ -788,7 +782,7 @@ void cProtocol190::SendPickupSpawn(const cPickup & a_Pickup) -void cProtocol190::SendPlayerAbilities(void) +void cProtocol_1_9_0::SendPlayerAbilities(void) { ASSERT(m_State == 3); // In game mode? @@ -817,7 +811,7 @@ void cProtocol190::SendPlayerAbilities(void) -void cProtocol190::SendEntityAnimation(const cEntity & a_Entity, char a_Animation) +void cProtocol_1_9_0::SendEntityAnimation(const cEntity & a_Entity, char a_Animation) { ASSERT(m_State == 3); // In game mode? @@ -830,7 +824,7 @@ void cProtocol190::SendEntityAnimation(const cEntity & a_Entity, char a_Animatio -void cProtocol190::SendParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) +void cProtocol_1_9_0::SendParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) { ASSERT(m_State == 3); // In game mode? int ParticleID = GetParticleID(a_ParticleName); @@ -852,7 +846,7 @@ void cProtocol190::SendParticleEffect(const AString & a_ParticleName, float a_Sr -void cProtocol190::SendParticleEffect(const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data) +void cProtocol_1_9_0::SendParticleEffect(const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data) { ASSERT(m_State == 3); // In game mode? int ParticleID = GetParticleID(a_ParticleName); @@ -896,7 +890,7 @@ void cProtocol190::SendParticleEffect(const AString & a_ParticleName, Vector3f a -void cProtocol190::SendPlayerListAddPlayer(const cPlayer & a_Player) +void cProtocol_1_9_0::SendPlayerListAddPlayer(const cPlayer & a_Player) { ASSERT(m_State == 3); // In game mode? @@ -933,7 +927,7 @@ void cProtocol190::SendPlayerListAddPlayer(const cPlayer & a_Player) -void cProtocol190::SendPlayerListRemovePlayer(const cPlayer & a_Player) +void cProtocol_1_9_0::SendPlayerListRemovePlayer(const cPlayer & a_Player) { ASSERT(m_State == 3); // In game mode? @@ -947,7 +941,7 @@ void cProtocol190::SendPlayerListRemovePlayer(const cPlayer & a_Player) -void cProtocol190::SendPlayerListUpdateGameMode(const cPlayer & a_Player) +void cProtocol_1_9_0::SendPlayerListUpdateGameMode(const cPlayer & a_Player) { ASSERT(m_State == 3); // In game mode? @@ -962,7 +956,7 @@ void cProtocol190::SendPlayerListUpdateGameMode(const cPlayer & a_Player) -void cProtocol190::SendPlayerListUpdatePing(const cPlayer & a_Player) +void cProtocol_1_9_0::SendPlayerListUpdatePing(const cPlayer & a_Player) { ASSERT(m_State == 3); // In game mode? @@ -981,7 +975,7 @@ void cProtocol190::SendPlayerListUpdatePing(const cPlayer & a_Player) -void cProtocol190::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName) +void cProtocol_1_9_0::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName) { ASSERT(m_State == 3); // In game mode? @@ -1005,7 +999,7 @@ void cProtocol190::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, con -void cProtocol190::SendPlayerMaxSpeed(void) +void cProtocol_1_9_0::SendPlayerMaxSpeed(void) { ASSERT(m_State == 3); // In game mode? @@ -1034,7 +1028,7 @@ void cProtocol190::SendPlayerMaxSpeed(void) -void cProtocol190::SendPlayerMoveLook(void) +void cProtocol_1_9_0::SendPlayerMoveLook(void) { ASSERT(m_State == 3); // In game mode? @@ -1053,7 +1047,7 @@ void cProtocol190::SendPlayerMoveLook(void) -void cProtocol190::SendPlayerPosition(void) +void cProtocol_1_9_0::SendPlayerPosition(void) { // There is no dedicated packet for this, send the whole thing: SendPlayerMoveLook(); @@ -1063,7 +1057,7 @@ void cProtocol190::SendPlayerPosition(void) -void cProtocol190::SendPlayerSpawn(const cPlayer & a_Player) +void cProtocol_1_9_0::SendPlayerSpawn(const cPlayer & a_Player) { // Called to spawn another player for the client cPacketizer Pkt(*this, 0x05); // Spawn Player packet @@ -1082,7 +1076,7 @@ void cProtocol190::SendPlayerSpawn(const cPlayer & a_Player) -void cProtocol190::SendPluginMessage(const AString & a_Channel, const AString & a_Message) +void cProtocol_1_9_0::SendPluginMessage(const AString & a_Channel, const AString & a_Message) { ASSERT(m_State == 3); // In game mode? @@ -1095,7 +1089,7 @@ void cProtocol190::SendPluginMessage(const AString & a_Channel, const AString & -void cProtocol190::SendRemoveEntityEffect(const cEntity & a_Entity, int a_EffectID) +void cProtocol_1_9_0::SendRemoveEntityEffect(const cEntity & a_Entity, int a_EffectID) { ASSERT(m_State == 3); // In game mode? @@ -1108,7 +1102,7 @@ void cProtocol190::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effect -void cProtocol190::SendResetTitle(void) +void cProtocol_1_9_0::SendResetTitle(void) { ASSERT(m_State == 3); // In game mode? @@ -1120,7 +1114,7 @@ void cProtocol190::SendResetTitle(void) -void cProtocol190::SendRespawn(eDimension a_Dimension) +void cProtocol_1_9_0::SendRespawn(eDimension a_Dimension) { cPacketizer Pkt(*this, 0x33); // Respawn packet cPlayer * Player = m_Client->GetPlayer(); @@ -1134,7 +1128,7 @@ void cProtocol190::SendRespawn(eDimension a_Dimension) -void cProtocol190::SendExperience(void) +void cProtocol_1_9_0::SendExperience(void) { ASSERT(m_State == 3); // In game mode? @@ -1149,7 +1143,7 @@ void cProtocol190::SendExperience(void) -void cProtocol190::SendExperienceOrb(const cExpOrb & a_ExpOrb) +void cProtocol_1_9_0::SendExperienceOrb(const cExpOrb & a_ExpOrb) { ASSERT(m_State == 3); // In game mode? @@ -1165,7 +1159,7 @@ void cProtocol190::SendExperienceOrb(const cExpOrb & a_ExpOrb) -void cProtocol190::SendScoreboardObjective(const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) +void cProtocol_1_9_0::SendScoreboardObjective(const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) { ASSERT(m_State == 3); // In game mode? @@ -1183,7 +1177,7 @@ void cProtocol190::SendScoreboardObjective(const AString & a_Name, const AString -void cProtocol190::SendScoreUpdate(const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) +void cProtocol_1_9_0::SendScoreUpdate(const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) { ASSERT(m_State == 3); // In game mode? @@ -1202,7 +1196,7 @@ void cProtocol190::SendScoreUpdate(const AString & a_Objective, const AString & -void cProtocol190::SendDisplayObjective(const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) +void cProtocol_1_9_0::SendDisplayObjective(const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) { ASSERT(m_State == 3); // In game mode? @@ -1215,7 +1209,7 @@ void cProtocol190::SendDisplayObjective(const AString & a_Objective, cScoreboard -void cProtocol190::SendSetSubTitle(const cCompositeChat & a_SubTitle) +void cProtocol_1_9_0::SendSetSubTitle(const cCompositeChat & a_SubTitle) { SendSetRawSubTitle(a_SubTitle.CreateJsonString(false)); } @@ -1224,7 +1218,7 @@ void cProtocol190::SendSetSubTitle(const cCompositeChat & a_SubTitle) -void cProtocol190::SendSetRawSubTitle(const AString & a_SubTitle) +void cProtocol_1_9_0::SendSetRawSubTitle(const AString & a_SubTitle) { ASSERT(m_State == 3); // In game mode? @@ -1238,7 +1232,7 @@ void cProtocol190::SendSetRawSubTitle(const AString & a_SubTitle) -void cProtocol190::SendSetTitle(const cCompositeChat & a_Title) +void cProtocol_1_9_0::SendSetTitle(const cCompositeChat & a_Title) { SendSetRawTitle(a_Title.CreateJsonString(false)); } @@ -1247,7 +1241,7 @@ void cProtocol190::SendSetTitle(const cCompositeChat & a_Title) -void cProtocol190::SendSetRawTitle(const AString & a_Title) +void cProtocol_1_9_0::SendSetRawTitle(const AString & a_Title) { ASSERT(m_State == 3); // In game mode? @@ -1261,7 +1255,7 @@ void cProtocol190::SendSetRawTitle(const AString & a_Title) -void cProtocol190::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) +void cProtocol_1_9_0::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) { ASSERT(m_State == 3); // In game mode? @@ -1279,7 +1273,7 @@ void cProtocol190::SendSoundEffect(const AString & a_SoundName, double a_X, doub -void cProtocol190::SendSoundParticleEffect(const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) +void cProtocol_1_9_0::SendSoundParticleEffect(const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) { ASSERT(m_State == 3); // In game mode? @@ -1294,7 +1288,7 @@ void cProtocol190::SendSoundParticleEffect(const EffectID a_EffectID, int a_SrcX -void cProtocol190::SendSpawnFallingBlock(const cFallingBlock & a_FallingBlock) +void cProtocol_1_9_0::SendSpawnFallingBlock(const cFallingBlock & a_FallingBlock) { ASSERT(m_State == 3); // In game mode? @@ -1319,7 +1313,7 @@ void cProtocol190::SendSpawnFallingBlock(const cFallingBlock & a_FallingBlock) -void cProtocol190::SendSpawnMob(const cMonster & a_Mob) +void cProtocol_1_9_0::SendSpawnMob(const cMonster & a_Mob) { ASSERT(m_State == 3); // In game mode? @@ -1346,7 +1340,7 @@ void cProtocol190::SendSpawnMob(const cMonster & a_Mob) -void cProtocol190::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) +void cProtocol_1_9_0::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) { ASSERT(m_State == 3); // In game mode? double PosX = a_Entity.GetPosX(); @@ -1378,7 +1372,7 @@ void cProtocol190::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, -void cProtocol190::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) +void cProtocol_1_9_0::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) { ASSERT(m_State == 3); // In game mode? @@ -1403,7 +1397,7 @@ void cProtocol190::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleTyp -void cProtocol190::SendStatistics(const cStatManager & a_Manager) +void cProtocol_1_9_0::SendStatistics(const cStatManager & a_Manager) { ASSERT(m_State == 3); // In game mode? @@ -1425,7 +1419,7 @@ void cProtocol190::SendStatistics(const cStatManager & a_Manager) -void cProtocol190::SendTabCompletionResults(const AStringVector & a_Results) +void cProtocol_1_9_0::SendTabCompletionResults(const AStringVector & a_Results) { ASSERT(m_State == 3); // In game mode? @@ -1442,7 +1436,7 @@ void cProtocol190::SendTabCompletionResults(const AStringVector & a_Results) -void cProtocol190::SendTeleportEntity(const cEntity & a_Entity) +void cProtocol_1_9_0::SendTeleportEntity(const cEntity & a_Entity) { ASSERT(m_State == 3); // In game mode? @@ -1460,7 +1454,7 @@ void cProtocol190::SendTeleportEntity(const cEntity & a_Entity) -void cProtocol190::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ) +void cProtocol_1_9_0::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ) { ASSERT(m_State == 3); // In game mode? @@ -1476,7 +1470,7 @@ void cProtocol190::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ) -void cProtocol190::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) +void cProtocol_1_9_0::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) { ASSERT(m_State == 3); // In game mode? @@ -1492,7 +1486,7 @@ void cProtocol190::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_F -void cProtocol190::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) +void cProtocol_1_9_0::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) { ASSERT(m_State == 3); // In game mode? if (!a_DoDaylightCycle) @@ -1510,7 +1504,7 @@ void cProtocol190::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_Do -void cProtocol190::SendUnloadChunk(int a_ChunkX, int a_ChunkZ) +void cProtocol_1_9_0::SendUnloadChunk(int a_ChunkX, int a_ChunkZ) { ASSERT(m_State == 3); // In game mode? @@ -1522,7 +1516,7 @@ void cProtocol190::SendUnloadChunk(int a_ChunkX, int a_ChunkZ) -void cProtocol190::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity) +void cProtocol_1_9_0::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity) { ASSERT(m_State == 3); // In game mode? @@ -1548,7 +1542,7 @@ void cProtocol190::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity) -void cProtocol190::SendUpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) +void cProtocol_1_9_0::SendUpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) { ASSERT(m_State == 3); // In game mode? @@ -1569,7 +1563,7 @@ void cProtocol190::SendUpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, cons -void cProtocol190::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) +void cProtocol_1_9_0::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) { ASSERT(m_State == 3); // In game mode? @@ -1582,7 +1576,7 @@ void cProtocol190::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_Bloc -void cProtocol190::SendWeather(eWeather a_Weather) +void cProtocol_1_9_0::SendWeather(eWeather a_Weather) { ASSERT(m_State == 3); // In game mode? @@ -1599,7 +1593,7 @@ void cProtocol190::SendWeather(eWeather a_Weather) -void cProtocol190::SendWholeInventory(const cWindow & a_Window) +void cProtocol_1_9_0::SendWholeInventory(const cWindow & a_Window) { ASSERT(m_State == 3); // In game mode? @@ -1618,7 +1612,7 @@ void cProtocol190::SendWholeInventory(const cWindow & a_Window) -void cProtocol190::SendWindowClose(const cWindow & a_Window) +void cProtocol_1_9_0::SendWindowClose(const cWindow & a_Window) { ASSERT(m_State == 3); // In game mode? @@ -1630,7 +1624,7 @@ void cProtocol190::SendWindowClose(const cWindow & a_Window) -void cProtocol190::SendWindowOpen(const cWindow & a_Window) +void cProtocol_1_9_0::SendWindowOpen(const cWindow & a_Window) { ASSERT(m_State == 3); // In game mode? @@ -1671,7 +1665,7 @@ void cProtocol190::SendWindowOpen(const cWindow & a_Window) -void cProtocol190::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value) +void cProtocol_1_9_0::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value) { ASSERT(m_State == 3); // In game mode? @@ -1685,7 +1679,7 @@ void cProtocol190::SendWindowProperty(const cWindow & a_Window, short a_Property -bool cProtocol190::CompressPacket(const AString & a_Packet, AString & a_CompressedData) +bool cProtocol_1_9_0::CompressPacket(const AString & a_Packet, AString & a_CompressedData) { // Compress the data: char CompressedData[MAX_COMPRESSED_PACKET_LEN]; @@ -1728,7 +1722,7 @@ bool cProtocol190::CompressPacket(const AString & a_Packet, AString & a_Compress -int cProtocol190::GetParticleID(const AString & a_ParticleName) +int cProtocol_1_9_0::GetParticleID(const AString & a_ParticleName) { static bool IsInitialized = false; static std::map<AString, int> ParticleMap; @@ -1794,7 +1788,7 @@ int cProtocol190::GetParticleID(const AString & a_ParticleName) -void cProtocol190::FixItemFramePositions(int a_ObjectData, double & a_PosX, double & a_PosZ, double & a_Yaw) +void cProtocol_1_9_0::FixItemFramePositions(int a_ObjectData, double & a_PosX, double & a_PosZ, double & a_Yaw) { switch (a_ObjectData) { @@ -1829,7 +1823,7 @@ void cProtocol190::FixItemFramePositions(int a_ObjectData, double & a_PosX, doub -void cProtocol190::AddReceivedData(const char * a_Data, size_t a_Size) +void cProtocol_1_9_0::AddReceivedData(const char * a_Data, size_t a_Size) { // Write the incoming data into the comm log file: if (g_ShouldLogCommIn && m_CommLogFile.IsOpen()) @@ -2024,7 +2018,7 @@ void cProtocol190::AddReceivedData(const char * a_Data, size_t a_Size) -bool cProtocol190::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) +bool cProtocol_1_9_0::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) { switch (m_State) { @@ -2116,7 +2110,7 @@ bool cProtocol190::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) -void cProtocol190::HandlePacketStatusPing(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketStatusPing(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEInt64, Int64, Timestamp); @@ -2128,7 +2122,7 @@ void cProtocol190::HandlePacketStatusPing(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) { cServer * Server = cRoot::Get()->GetServer(); AString ServerDescription = Server->GetDescription(); @@ -2173,7 +2167,7 @@ void cProtocol190::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketLoginEncryptionResponse(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketLoginEncryptionResponse(cByteBuffer & a_ByteBuffer) { UInt32 EncKeyLength, EncNonceLength; if (!a_ByteBuffer.ReadVarInt(EncKeyLength)) @@ -2236,7 +2230,7 @@ void cProtocol190::HandlePacketLoginEncryptionResponse(cByteBuffer & a_ByteBuffe -void cProtocol190::HandlePacketLoginStart(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketLoginStart(cByteBuffer & a_ByteBuffer) { AString Username; if (!a_ByteBuffer.ReadVarUTF8String(Username)) @@ -2273,7 +2267,7 @@ void cProtocol190::HandlePacketLoginStart(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketAnimation(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketAnimation(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarInt, Int32, Hand); @@ -2284,7 +2278,7 @@ void cProtocol190::HandlePacketAnimation(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketBlockDig(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketBlockDig(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, Status); @@ -2302,7 +2296,7 @@ void cProtocol190::HandlePacketBlockDig(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketBlockPlace(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketBlockPlace(cByteBuffer & a_ByteBuffer) { int BlockX, BlockY, BlockZ; if (!a_ByteBuffer.ReadPosition64(BlockX, BlockY, BlockZ)) @@ -2322,7 +2316,7 @@ void cProtocol190::HandlePacketBlockPlace(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketBoatSteer(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketBoatSteer(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBool, bool, RightPaddle); HANDLE_READ(a_ByteBuffer, ReadBool, bool, LeftPaddle); @@ -2345,7 +2339,7 @@ void cProtocol190::HandlePacketBoatSteer(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketChatMessage(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketChatMessage(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Message); m_Client->HandleChat(Message); @@ -2355,7 +2349,7 @@ void cProtocol190::HandlePacketChatMessage(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketClientSettings(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketClientSettings(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Locale); HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, ViewDistance); @@ -2373,7 +2367,7 @@ void cProtocol190::HandlePacketClientSettings(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketClientStatus(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketClientStatus(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, ActionID); switch (ActionID) @@ -2405,7 +2399,7 @@ void cProtocol190::HandlePacketClientStatus(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandleConfirmTeleport(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandleConfirmTeleport(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarInt32, UInt32, TeleportID); // We don't actually validate that this packet is sent or anything yet, but it still needs to be read. @@ -2415,7 +2409,7 @@ void cProtocol190::HandleConfirmTeleport(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketCreativeInventoryAction(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketCreativeInventoryAction(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEInt16, Int16, SlotNum); cItem Item; @@ -2430,7 +2424,7 @@ void cProtocol190::HandlePacketCreativeInventoryAction(cByteBuffer & a_ByteBuffe -void cProtocol190::HandlePacketEntityAction(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketEntityAction(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarInt, UInt32, PlayerID); HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, Action); @@ -2450,7 +2444,7 @@ void cProtocol190::HandlePacketEntityAction(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketKeepAlive(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketKeepAlive(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarInt, UInt32, KeepAliveID); m_Client->HandleKeepAlive(KeepAliveID); @@ -2460,7 +2454,7 @@ void cProtocol190::HandlePacketKeepAlive(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketPlayer(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketPlayer(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBool, bool, IsOnGround); // TODO: m_Client->HandlePlayerOnGround(IsOnGround); @@ -2470,7 +2464,7 @@ void cProtocol190::HandlePacketPlayer(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketPlayerAbilities(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketPlayerAbilities(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, Flags); HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, FlyingSpeed); @@ -2494,7 +2488,7 @@ void cProtocol190::HandlePacketPlayerAbilities(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketPlayerLook(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketPlayerLook(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, Yaw); HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, Pitch); @@ -2506,7 +2500,7 @@ void cProtocol190::HandlePacketPlayerLook(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketPlayerPos(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketPlayerPos(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEDouble, double, PosX); HANDLE_READ(a_ByteBuffer, ReadBEDouble, double, PosY); @@ -2519,7 +2513,7 @@ void cProtocol190::HandlePacketPlayerPos(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketPlayerPosLook(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketPlayerPosLook(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEDouble, double, PosX); HANDLE_READ(a_ByteBuffer, ReadBEDouble, double, PosY); @@ -2534,7 +2528,7 @@ void cProtocol190::HandlePacketPlayerPosLook(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Channel); @@ -2565,7 +2559,7 @@ void cProtocol190::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketSlotSelect(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketSlotSelect(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEInt16, Int16, SlotNum); m_Client->HandleSlotSelected(SlotNum); @@ -2575,7 +2569,7 @@ void cProtocol190::HandlePacketSlotSelect(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketSpectate(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketSpectate(cByteBuffer & a_ByteBuffer) { AString playerUUID; if (!a_ByteBuffer.ReadUUID(playerUUID)) @@ -2590,7 +2584,7 @@ void cProtocol190::HandlePacketSpectate(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketSteerVehicle(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketSteerVehicle(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, Sideways); HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, Forward); @@ -2614,7 +2608,7 @@ void cProtocol190::HandlePacketSteerVehicle(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketTabComplete(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketTabComplete(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Text); HANDLE_READ(a_ByteBuffer, ReadBool, bool, AssumeCommand); @@ -2632,7 +2626,7 @@ void cProtocol190::HandlePacketTabComplete(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketUpdateSign(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketUpdateSign(cByteBuffer & a_ByteBuffer) { int BlockX, BlockY, BlockZ; if (!a_ByteBuffer.ReadPosition64(BlockX, BlockY, BlockZ)) @@ -2654,7 +2648,7 @@ void cProtocol190::HandlePacketUpdateSign(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketUseEntity(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketUseEntity(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarInt, UInt32, EntityID); HANDLE_READ(a_ByteBuffer, ReadVarInt, UInt32, Type); @@ -2694,7 +2688,7 @@ void cProtocol190::HandlePacketUseEntity(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketUseItem(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketUseItem(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarInt, UInt64, Hand); @@ -2706,7 +2700,7 @@ void cProtocol190::HandlePacketUseItem(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketEnchantItem(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketEnchantItem(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, WindowID); HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, Enchantment); @@ -2718,7 +2712,7 @@ void cProtocol190::HandlePacketEnchantItem(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketVehicleMove(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketVehicleMove(cByteBuffer & a_ByteBuffer) { // This handles updating the vehicles location server side HANDLE_READ(a_ByteBuffer, ReadBEDouble, double, xPos); @@ -2744,7 +2738,7 @@ void cProtocol190::HandlePacketVehicleMove(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketWindowClick(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketWindowClick(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, WindowID); HANDLE_READ(a_ByteBuffer, ReadBEInt16, Int16, SlotNum); @@ -2796,7 +2790,7 @@ void cProtocol190::HandlePacketWindowClick(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandlePacketWindowClose(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_0::HandlePacketWindowClose(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, WindowID); m_Client->HandleWindowClose(WindowID); @@ -2806,7 +2800,7 @@ void cProtocol190::HandlePacketWindowClose(cByteBuffer & a_ByteBuffer) -void cProtocol190::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, const AString & a_Channel) +void cProtocol_1_9_0::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, const AString & a_Channel) { if (a_Channel == "MC|AdvCdm") { @@ -2871,7 +2865,7 @@ void cProtocol190::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, const -void cProtocol190::SendData(const char * a_Data, size_t a_Size) +void cProtocol_1_9_0::SendData(const char * a_Data, size_t a_Size) { if (m_IsEncrypted) { @@ -2895,7 +2889,7 @@ void cProtocol190::SendData(const char * a_Data, size_t a_Size) -bool cProtocol190::ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item, size_t a_KeepRemainingBytes) +bool cProtocol_1_9_0::ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item, size_t a_KeepRemainingBytes) { HANDLE_PACKET_READ(a_ByteBuffer, ReadBEInt16, Int16, ItemType); if (ItemType == -1) @@ -2930,7 +2924,7 @@ bool cProtocol190::ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item, size_t a -void cProtocol190::ParseItemMetadata(cItem & a_Item, const AString & a_Metadata) +void cProtocol_1_9_0::ParseItemMetadata(cItem & a_Item, const AString & a_Metadata) { // Parse into NBT: cParsedNBT NBT(a_Metadata.data(), a_Metadata.size()); @@ -3133,7 +3127,7 @@ void cProtocol190::ParseItemMetadata(cItem & a_Item, const AString & a_Metadata) -void cProtocol190::StartEncryption(const Byte * a_Key) +void cProtocol_1_9_0::StartEncryption(const Byte * a_Key) { m_Encryptor.Init(a_Key, a_Key); m_Decryptor.Init(a_Key, a_Key); @@ -3155,7 +3149,7 @@ void cProtocol190::StartEncryption(const Byte * a_Key) -eBlockFace cProtocol190::FaceIntToBlockFace(Int32 a_BlockFace) +eBlockFace cProtocol_1_9_0::FaceIntToBlockFace(Int32 a_BlockFace) { // Normalize the blockface values returned from the protocol // Anything known gets mapped 1:1, everything else returns BLOCK_FACE_NONE @@ -3176,9 +3170,9 @@ eBlockFace cProtocol190::FaceIntToBlockFace(Int32 a_BlockFace) //////////////////////////////////////////////////////////////////////////////// -// cProtocol190::cPacketizer: +// cProtocol_1_9_0::cPacketizer: -void cProtocol190::SendPacket(cPacketizer & a_Pkt) +void cProtocol_1_9_0::SendPacket(cPacketizer & a_Pkt) { UInt32 PacketLen = static_cast<UInt32>(m_OutPacketBuffer.GetUsedSpace()); AString PacketData, CompressedPacket; @@ -3188,7 +3182,7 @@ void cProtocol190::SendPacket(cPacketizer & a_Pkt) if ((m_State == 3) && (PacketLen >= 256)) { // Compress the packet payload: - if (!cProtocol190::CompressPacket(PacketData, CompressedPacket)) + if (!cProtocol_1_9_0::CompressPacket(PacketData, CompressedPacket)) { return; } @@ -3238,7 +3232,7 @@ void cProtocol190::SendPacket(cPacketizer & a_Pkt) -void cProtocol190::WriteItem(cPacketizer & a_Pkt, const cItem & a_Item) +void cProtocol_1_9_0::WriteItem(cPacketizer & a_Pkt, const cItem & a_Item) { short ItemType = a_Item.m_ItemType; ASSERT(ItemType >= -1); // Check validity of packets in debug runtime @@ -3413,7 +3407,7 @@ void cProtocol190::WriteItem(cPacketizer & a_Pkt, const cItem & a_Item) -void cProtocol190::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity & a_BlockEntity) +void cProtocol_1_9_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity & a_BlockEntity) { cFastNBTWriter Writer; @@ -3517,7 +3511,7 @@ void cProtocol190::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity & a_ -void cProtocol190::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_Entity) +void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_Entity) { // Common metadata: Int8 Flags = 0; @@ -3712,7 +3706,7 @@ void cProtocol190::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_En -void cProtocol190::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob) +void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob) { // Living Enitiy Metadata if (a_Mob.HasCustomName()) @@ -4045,7 +4039,7 @@ void cProtocol190::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob) -void cProtocol190::WriteEntityProperties(cPacketizer & a_Pkt, const cEntity & a_Entity) +void cProtocol_1_9_0::WriteEntityProperties(cPacketizer & a_Pkt, const cEntity & a_Entity) { if (!a_Entity.IsMob()) { @@ -4066,9 +4060,9 @@ void cProtocol190::WriteEntityProperties(cPacketizer & a_Pkt, const cEntity & a_ //////////////////////////////////////////////////////////////////////////////// -// cProtocol191: +// cProtocol_1_9_1: -cProtocol191::cProtocol191(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) : +cProtocol_1_9_1::cProtocol_1_9_1(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) : super(a_Client, a_ServerAddress, a_ServerPort, a_State) { } @@ -4077,7 +4071,7 @@ cProtocol191::cProtocol191(cClientHandle * a_Client, const AString &a_ServerAddr -void cProtocol191::SendLogin(const cPlayer & a_Player, const cWorld & a_World) +void cProtocol_1_9_1::SendLogin(const cPlayer & a_Player, const cWorld & a_World) { // Send the Join Game packet: { @@ -4112,7 +4106,7 @@ void cProtocol191::SendLogin(const cPlayer & a_Player, const cWorld & a_World) -void cProtocol191::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_1::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) { cServer * Server = cRoot::Get()->GetServer(); AString ServerDescription = Server->GetDescription(); @@ -4158,9 +4152,9 @@ void cProtocol191::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) //////////////////////////////////////////////////////////////////////////////// -// cProtocol192: +// cProtocol_1_9_2: -cProtocol192::cProtocol192(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) : +cProtocol_1_9_2::cProtocol_1_9_2(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) : super(a_Client, a_ServerAddress, a_ServerPort, a_State) { } @@ -4169,7 +4163,7 @@ cProtocol192::cProtocol192(cClientHandle * a_Client, const AString &a_ServerAddr -void cProtocol192::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_2::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) { cServer * Server = cRoot::Get()->GetServer(); AString ServerDescription = Server->GetDescription(); @@ -4215,9 +4209,9 @@ void cProtocol192::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) //////////////////////////////////////////////////////////////////////////////// -// cProtocol194: +// cProtocol_1_9_4: -cProtocol194::cProtocol194(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) : +cProtocol_1_9_4::cProtocol_1_9_4(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) : super(a_Client, a_ServerAddress, a_ServerPort, a_State) { } @@ -4226,7 +4220,7 @@ cProtocol194::cProtocol194(cClientHandle * a_Client, const AString &a_ServerAddr -void cProtocol194::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) +void cProtocol_1_9_4::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) { cServer * Server = cRoot::Get()->GetServer(); AString ServerDescription = Server->GetDescription(); @@ -4271,8 +4265,9 @@ void cProtocol194::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) -void cProtocol194::SendCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player) +void cProtocol_1_9_4::SendCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player, int a_Count) { + UNUSED(a_Count); ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, 0x48); // Collect Item packet @@ -4284,7 +4279,7 @@ void cProtocol194::SendCollectEntity(const cEntity & a_Entity, const cPlayer & a -void cProtocol194::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) +void cProtocol_1_9_4::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) { ASSERT(m_State == 3); // In game mode? @@ -4300,7 +4295,7 @@ void cProtocol194::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerialize -void cProtocol194::SendEntityEffect(const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) +void cProtocol_1_9_4::SendEntityEffect(const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) { ASSERT(m_State == 3); // In game mode? @@ -4316,7 +4311,7 @@ void cProtocol194::SendEntityEffect(const cEntity & a_Entity, int a_EffectID, in -void cProtocol194::SendEntityProperties(const cEntity & a_Entity) +void cProtocol_1_9_4::SendEntityProperties(const cEntity & a_Entity) { ASSERT(m_State == 3); // In game mode? @@ -4330,7 +4325,7 @@ void cProtocol194::SendEntityProperties(const cEntity & a_Entity) -void cProtocol194::SendPlayerMaxSpeed(void) +void cProtocol_1_9_4::SendPlayerMaxSpeed(void) { ASSERT(m_State == 3); // In game mode? @@ -4359,7 +4354,7 @@ void cProtocol194::SendPlayerMaxSpeed(void) -void cProtocol194::SendTeleportEntity(const cEntity & a_Entity) +void cProtocol_1_9_4::SendTeleportEntity(const cEntity & a_Entity) { ASSERT(m_State == 3); // In game mode? @@ -4377,7 +4372,7 @@ void cProtocol194::SendTeleportEntity(const cEntity & a_Entity) -void cProtocol194::SendUpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) +void cProtocol_1_9_4::SendUpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) { ASSERT(m_State == 3); // In game mode? diff --git a/src/Protocol/Protocol19x.h b/src/Protocol/Protocol_1_9.h index 64cad081f..99fc87b69 100644 --- a/src/Protocol/Protocol19x.h +++ b/src/Protocol/Protocol_1_9.h @@ -1,17 +1,16 @@ -// Protocol19x.h +// Protocol_1_9.h /* -Declares the 1.9.x protocol classes: - - cProtocol190 - - release 1.9.0 protocol (#107) - - cProtocol191 +Declares the 1.9 protocol classes: + - cProtocol_1_9_0 + - release 1.9 protocol (#107) + - cProtocol_1_9_1 - release 1.9.1 protocol (#108) - - cProtocol192 + - cProtocol_1_9_2 - release 1.9.2 protocol (#109) - - cProtocol194 + - cProtocol_1_9_4 - release 1.9.4 protocol (#110) -(others may be added later in the future for the 1.9 release series) */ @@ -53,14 +52,14 @@ namespace Json -class cProtocol190 : +class cProtocol_1_9_0 : public cProtocol { typedef cProtocol super; public: - cProtocol190(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State); + cProtocol_1_9_0(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State); /** Called when client sends some data: */ virtual void DataReceived(const char * a_Data, size_t a_Size) override; @@ -76,7 +75,7 @@ public: virtual void SendChat (const cCompositeChat & a_Message, eChatType a_Type, bool a_ShouldUseChatPrefixes) override; virtual void SendChatRaw (const AString & a_MessageRaw, eChatType a_Type) override; virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override; - virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) override; + virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player, int a_Count) override; virtual void SendDestroyEntity (const cEntity & a_Entity) override; virtual void SendDetachEntity (const cEntity & a_Entity, const cEntity & a_PreviousVehicle) override; virtual void SendDisconnect (const AString & a_Reason) override; @@ -189,51 +188,50 @@ protected: void AddReceivedData(const char * a_Data, size_t a_Size); /** Reads and handles the packet. The packet length and type have already been read. - Returns true if the packet was understood, false if it was an unknown packet - */ - bool HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType); + Returns true if the packet was understood, false if it was an unknown packet. */ + virtual bool HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType); // Packet handlers while in the Status state (m_State == 1): virtual void HandlePacketStatusPing(cByteBuffer & a_ByteBuffer); virtual void HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer); // Packet handlers while in the Login state (m_State == 2): - void HandlePacketLoginEncryptionResponse(cByteBuffer & a_ByteBuffer); - void HandlePacketLoginStart(cByteBuffer & a_ByteBuffer); + virtual void HandlePacketLoginEncryptionResponse(cByteBuffer & a_ByteBuffer); + virtual void HandlePacketLoginStart(cByteBuffer & a_ByteBuffer); // Packet handlers while in the Game state (m_State == 3): - void HandlePacketAnimation (cByteBuffer & a_ByteBuffer); - void HandlePacketBlockDig (cByteBuffer & a_ByteBuffer); - void HandlePacketBlockPlace (cByteBuffer & a_ByteBuffer); - void HandlePacketBoatSteer (cByteBuffer & a_ByteBuffer); - void HandlePacketChatMessage (cByteBuffer & a_ByteBuffer); - void HandlePacketClientSettings (cByteBuffer & a_ByteBuffer); - void HandlePacketClientStatus (cByteBuffer & a_ByteBuffer); - void HandleConfirmTeleport (cByteBuffer & a_ByteBuffer); - void HandlePacketCreativeInventoryAction(cByteBuffer & a_ByteBuffer); - void HandlePacketEntityAction (cByteBuffer & a_ByteBuffer); - void HandlePacketKeepAlive (cByteBuffer & a_ByteBuffer); - void HandlePacketPlayer (cByteBuffer & a_ByteBuffer); - void HandlePacketPlayerAbilities (cByteBuffer & a_ByteBuffer); - void HandlePacketPlayerLook (cByteBuffer & a_ByteBuffer); - void HandlePacketPlayerPos (cByteBuffer & a_ByteBuffer); - void HandlePacketPlayerPosLook (cByteBuffer & a_ByteBuffer); - void HandlePacketPluginMessage (cByteBuffer & a_ByteBuffer); - void HandlePacketSlotSelect (cByteBuffer & a_ByteBuffer); - void HandlePacketSteerVehicle (cByteBuffer & a_ByteBuffer); - void HandlePacketSpectate (cByteBuffer & a_ByteBuffer); - void HandlePacketTabComplete (cByteBuffer & a_ByteBuffer); - void HandlePacketUpdateSign (cByteBuffer & a_ByteBuffer); - void HandlePacketUseEntity (cByteBuffer & a_ByteBuffer); - void HandlePacketUseItem (cByteBuffer & a_ByteBuffer); - void HandlePacketEnchantItem (cByteBuffer & a_ByteBuffer); - void HandlePacketVehicleMove (cByteBuffer & a_ByteBuffer); - void HandlePacketWindowClick (cByteBuffer & a_ByteBuffer); - void HandlePacketWindowClose (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketAnimation (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketBlockDig (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketBlockPlace (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketBoatSteer (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketChatMessage (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketClientSettings (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketClientStatus (cByteBuffer & a_ByteBuffer); + virtual void HandleConfirmTeleport (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketCreativeInventoryAction(cByteBuffer & a_ByteBuffer); + virtual void HandlePacketEntityAction (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketKeepAlive (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketPlayer (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketPlayerAbilities (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketPlayerLook (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketPlayerPos (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketPlayerPosLook (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketPluginMessage (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketSlotSelect (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketSteerVehicle (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketSpectate (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketTabComplete (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketUpdateSign (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketUseEntity (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketUseItem (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketEnchantItem (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketVehicleMove (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketWindowClick (cByteBuffer & a_ByteBuffer); + virtual void HandlePacketWindowClose (cByteBuffer & a_ByteBuffer); /** Parses Vanilla plugin messages into specific ClientHandle calls. The message payload is still in the bytebuffer, the handler reads it specifically for each handled channel */ - void HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, const AString & a_Channel); + virtual void HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, const AString & a_Channel); /** Sends the data to the client, encrypting them if needed. */ @@ -297,15 +295,15 @@ protected: /** The version 108 protocol, used by 1.9.1. Uses an int rather than a byte for dimension in join game. */ -class cProtocol191 : - public cProtocol190 +class cProtocol_1_9_1 : + public cProtocol_1_9_0 { - typedef cProtocol190 super; + typedef cProtocol_1_9_0 super; public: - cProtocol191(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State); + cProtocol_1_9_1(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State); - // cProtocol190 overrides: + // cProtocol_1_9_0 overrides: virtual void SendLogin(const cPlayer & a_Player, const cWorld & a_World) override; virtual void HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) override; @@ -316,15 +314,15 @@ public: /** The version 109 protocol, used by 1.9.2. Same as 1.9.1, except the server list ping version number changed with the protocol number. */ -class cProtocol192 : - public cProtocol191 +class cProtocol_1_9_2 : + public cProtocol_1_9_1 { - typedef cProtocol191 super; + typedef cProtocol_1_9_1 super; public: - cProtocol192(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State); + cProtocol_1_9_2(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State); - // cProtocol190 overrides: + // cProtocol_1_9_1 overrides: virtual void HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) override; } ; @@ -334,16 +332,16 @@ public: /** The version 110 protocol, used by 1.9.3 and 1.9.4. */ -class cProtocol194 : - public cProtocol192 +class cProtocol_1_9_4 : + public cProtocol_1_9_2 { - typedef cProtocol192 super; + typedef cProtocol_1_9_2 super; public: - cProtocol194(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State); + cProtocol_1_9_4(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State); - // cProtocol190 overrides: - virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) override; + // cProtocol_1_9_2 overrides: + virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player, int a_Count) override; virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override; virtual void SendEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) override; virtual void SendEntityProperties(const cEntity & a_Entity) override; |