diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2020-07-20 09:55:11 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2020-07-20 10:28:02 +0200 |
commit | 07f3f7ec30ed0e751f614720b2f189f8d9f442cc (patch) | |
tree | dcde6ffe381e219a22756ea914037302840c9f76 | |
parent | Remove GetProtocolVersion unneeded comments (diff) | |
download | cuberite-07f3f7ec30ed0e751f614720b2f189f8d9f442cc.tar cuberite-07f3f7ec30ed0e751f614720b2f189f8d9f442cc.tar.gz cuberite-07f3f7ec30ed0e751f614720b2f189f8d9f442cc.tar.bz2 cuberite-07f3f7ec30ed0e751f614720b2f189f8d9f442cc.tar.lz cuberite-07f3f7ec30ed0e751f614720b2f189f8d9f442cc.tar.xz cuberite-07f3f7ec30ed0e751f614720b2f189f8d9f442cc.tar.zst cuberite-07f3f7ec30ed0e751f614720b2f189f8d9f442cc.zip |
-rw-r--r-- | src/Protocol/ChunkDataSerializer.cpp | 6 | ||||
-rw-r--r-- | src/Protocol/ChunkDataSerializer.h | 2 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_11.cpp | 1 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_12.cpp | 1 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_13.cpp | 20 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_13.h | 26 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_8.cpp | 2 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_8.h | 1 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_9.cpp | 2 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_9.h | 1 |
10 files changed, 22 insertions, 40 deletions
diff --git a/src/Protocol/ChunkDataSerializer.cpp b/src/Protocol/ChunkDataSerializer.cpp index bf8798d6f..6577aaedd 100644 --- a/src/Protocol/ChunkDataSerializer.cpp +++ b/src/Protocol/ChunkDataSerializer.cpp @@ -93,13 +93,13 @@ void cChunkDataSerializer::SendToClients(const std::unordered_set<cClientHandle } case cProtocol::Version::Version_1_13: { - Serialize393And401<&Palette_1_13::FromBlock>(Entry.second); // This version didn't last very long xD + Serialize393<&Palette_1_13::FromBlock>(Entry.second); // This version didn't last very long xD continue; } case cProtocol::Version::Version_1_13_1: case cProtocol::Version::Version_1_13_2: { - Serialize393And401<&Palette_1_13_1::FromBlock>(Entry.second); + Serialize393<&Palette_1_13_1::FromBlock>(Entry.second); continue; } } @@ -391,7 +391,7 @@ void cChunkDataSerializer::Serialize110(const std::vector<cClientHandle *> & a_S template <auto Palette> -void cChunkDataSerializer::Serialize393And401(const std::vector<cClientHandle *> & a_SendTo) +void cChunkDataSerializer::Serialize393(const std::vector<cClientHandle *> & a_SendTo) { // This function returns the fully compressed packet (including packet size), not the raw packet! diff --git a/src/Protocol/ChunkDataSerializer.h b/src/Protocol/ChunkDataSerializer.h index 69e0a7689..ed3e5c8b1 100644 --- a/src/Protocol/ChunkDataSerializer.h +++ b/src/Protocol/ChunkDataSerializer.h @@ -38,7 +38,7 @@ protected: void Serialize110(const std::vector<cClientHandle *> & a_SendTo); // Release 1.9.4 template <auto Palette> - void Serialize393And401(const std::vector<cClientHandle *> & a_SendTo); // Release 1.13 - 1.13.1 + void Serialize393(const std::vector<cClientHandle *> & a_SendTo); // Release 1.13 - 1.13.1 /** Finalises the data, compresses it if required, and delivers it to all clients. */ void CompressAndSend(cByteBuffer & a_Packet, const std::vector<cClientHandle *> & a_SendTo); diff --git a/src/Protocol/Protocol_1_11.cpp b/src/Protocol/Protocol_1_11.cpp index 70d4ee210..385dcb34a 100644 --- a/src/Protocol/Protocol_1_11.cpp +++ b/src/Protocol/Protocol_1_11.cpp @@ -11,7 +11,6 @@ Implements the 1.11 protocol classes: #include "Globals.h" #include "Protocol_1_11.h" -#include "ProtocolRecognizer.h" #include "Packetizer.h" #include "../WorldStorage/FastNBT.h" diff --git a/src/Protocol/Protocol_1_12.cpp b/src/Protocol/Protocol_1_12.cpp index 29e6cbac8..3be1fe672 100644 --- a/src/Protocol/Protocol_1_12.cpp +++ b/src/Protocol/Protocol_1_12.cpp @@ -8,7 +8,6 @@ Implements the 1.12 protocol classes: #include "Globals.h" #include "Protocol_1_12.h" -#include "ProtocolRecognizer.h" #include "Packetizer.h" #include "../Entities/Boat.h" diff --git a/src/Protocol/Protocol_1_13.cpp b/src/Protocol/Protocol_1_13.cpp index cab839678..c8c2e7383 100644 --- a/src/Protocol/Protocol_1_13.cpp +++ b/src/Protocol/Protocol_1_13.cpp @@ -8,8 +8,6 @@ Implements the 1.13 protocol classes: #include "Globals.h" #include "Protocol_1_13.h" -#include "ProtocolRecognizer.h" -#include "ChunkDataSerializer.h" #include "Packetizer.h" #include "../Entities/Boat.h" @@ -199,15 +197,6 @@ void cProtocol_1_13::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity) -cProtocol::Version cProtocol_1_13::GetProtocolVersion() -{ - return Version::Version_1_13; -} - - - - - bool cProtocol_1_13::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) { if (m_State != 3) @@ -286,6 +275,15 @@ void cProtocol_1_13::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer) +cProtocol::Version cProtocol_1_13::GetProtocolVersion() +{ + return Version::Version_1_13; +} + + + + + UInt32 cProtocol_1_13::GetPacketID(ePacketType a_PacketType) { switch (a_PacketType) diff --git a/src/Protocol/Protocol_1_13.h b/src/Protocol/Protocol_1_13.h index 80d086597..fa4625f7e 100644 --- a/src/Protocol/Protocol_1_13.h +++ b/src/Protocol/Protocol_1_13.h @@ -19,14 +19,6 @@ Declares the 1.13 protocol classes: #pragma once #include "Protocol_1_12.h" -#include "../World.h" - - - - - -// fwd: -class BlockTypePalette; @@ -45,9 +37,9 @@ protected: // Packet sending: virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; - template <auto Palette> void SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); // Template to avoid virutal calls in tight loops + template <auto Palette> void SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); // Template to avoid virtual calls in tight loops virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override; - template <auto Palette>void SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes); // Template to avoid virutal calls in tight loops + template <auto Palette>void SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes); // Template to avoid virtual calls in tight loops virtual void SendMapData (const cMap & a_Map, int a_DataStartX, int a_DataStartY) override; virtual void SendPaintingSpawn (const cPainting & a_Painting) override; virtual void SendParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data) override; @@ -57,16 +49,12 @@ protected: virtual void SendTabCompletionResults (const AStringVector & a_Results) override; virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override; - /** Returns 1.13. */ - virtual Version GetProtocolVersion() override; - - // Packet receiving: - virtual bool HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) override; - virtual void HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer) override; - // Outgoing packet type translation: virtual UInt32 GetPacketID(ePacketType a_PacketType) override; + /** Returns 1.13. */ + virtual Version GetProtocolVersion() override; + /** Converts eMonsterType to protocol-specific mob types */ virtual UInt32 GetProtocolMobType(eMonsterType a_MobType) override; @@ -75,6 +63,10 @@ protected: virtual std::pair<short, short> GetItemFromProtocolID(UInt32 a_ProtocolID); virtual UInt32 GetProtocolIDFromItem(short a_ItemID, short a_ItemDamage); + // Packet receiving: + virtual bool HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) override; + virtual void HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer) override; + virtual bool ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item, size_t a_KeepRemainingBytes) override; virtual void WriteItem(cPacketizer & a_Pkt, const cItem & a_Item) override; virtual void WriteEntityMetadata(cPacketizer & a_Pkt, const eEntityMetadata a_Metadata, const eEntityMetadataType a_FieldType); diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index eb277c5b4..50c70ef09 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -8,9 +8,7 @@ Implements the 1.8 protocol classes: */ #include "Globals.h" -#include "json/json.h" #include "Protocol_1_8.h" -#include "ChunkDataSerializer.h" #include "../mbedTLS++/Sha1Checksum.h" #include "Packetizer.h" diff --git a/src/Protocol/Protocol_1_8.h b/src/Protocol/Protocol_1_8.h index 005cabfe3..cd9e2f095 100644 --- a/src/Protocol/Protocol_1_8.h +++ b/src/Protocol/Protocol_1_8.h @@ -15,7 +15,6 @@ Declares the 1.8 protocol classes: #include "Protocol.h" #include "../ByteBuffer.h" -#include "../World.h" #include "../mbedTLS++/AesCfb128Decryptor.h" #include "../mbedTLS++/AesCfb128Encryptor.h" diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp index b6d8171f7..9bb0b7d08 100644 --- a/src/Protocol/Protocol_1_9.cpp +++ b/src/Protocol/Protocol_1_9.cpp @@ -14,9 +14,7 @@ Implements the 1.9 protocol classes: */ #include "Globals.h" -#include "json/json.h" #include "Protocol_1_9.h" -#include "ChunkDataSerializer.h" #include "../mbedTLS++/Sha1Checksum.h" #include "Packetizer.h" diff --git a/src/Protocol/Protocol_1_9.h b/src/Protocol/Protocol_1_9.h index 74ec584f0..e936710d7 100644 --- a/src/Protocol/Protocol_1_9.h +++ b/src/Protocol/Protocol_1_9.h @@ -22,7 +22,6 @@ Declares the 1.9 protocol classes: #include "Protocol.h" #include "Protocol_1_8.h" #include "../ByteBuffer.h" -#include "../World.h" #include "../mbedTLS++/AesCfb128Decryptor.h" #include "../mbedTLS++/AesCfb128Encryptor.h" |