diff options
author | Mattes D <github@xoft.cz> | 2016-12-16 00:28:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-16 00:28:12 +0100 |
commit | 71e14ee358e59314498e9b46484eff7e34ae6442 (patch) | |
tree | 56ca5369d83504ac063dbc3139f72dc2cdf42610 /src/Protocol/Protocol_1_9.h | |
parent | APIDump: Load the official undocumented from alternate location. (diff) | |
parent | CompositeChat: Use shorter JSON format. (diff) | |
download | cuberite-71e14ee358e59314498e9b46484eff7e34ae6442.tar cuberite-71e14ee358e59314498e9b46484eff7e34ae6442.tar.gz cuberite-71e14ee358e59314498e9b46484eff7e34ae6442.tar.bz2 cuberite-71e14ee358e59314498e9b46484eff7e34ae6442.tar.lz cuberite-71e14ee358e59314498e9b46484eff7e34ae6442.tar.xz cuberite-71e14ee358e59314498e9b46484eff7e34ae6442.tar.zst cuberite-71e14ee358e59314498e9b46484eff7e34ae6442.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Protocol/Protocol_1_9.h (renamed from src/Protocol/Protocol19x.h) | 120 |
1 files changed, 59 insertions, 61 deletions
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; |