diff options
Diffstat (limited to 'src/Protocol/Protocol_1_13.h')
-rw-r--r-- | src/Protocol/Protocol_1_13.h | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/src/Protocol/Protocol_1_13.h b/src/Protocol/Protocol_1_13.h index 3c3253cc5..1d19c59fe 100644 --- a/src/Protocol/Protocol_1_13.h +++ b/src/Protocol/Protocol_1_13.h @@ -37,26 +37,7 @@ public: protected: 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 virtual calls in tight loops virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override; - - /** Common implementation of multiblock change sending, templated to avoid virtual calls in tight loops. */ - template <auto Palette>void SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) - { - ASSERT(m_State == 3); // In game mode? - - cPacketizer Pkt(*this, pktBlockChanges); - Pkt.WriteBEInt32(a_ChunkX); - Pkt.WriteBEInt32(a_ChunkZ); - Pkt.WriteVarInt32(static_cast<UInt32>(a_Changes.size())); - for (const auto & Change : a_Changes) - { - Int16 Coords = static_cast<Int16>(Change.m_RelY | (Change.m_RelZ << 8) | (Change.m_RelX << 12)); - Pkt.WriteBEInt16(Coords); - Pkt.WriteVarInt32(Palette(PaletteUpgrade::FromBlock(Change.m_BlockType, Change.m_BlockMeta))); - } // for itr - a_Changes[] - } - 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; @@ -78,7 +59,8 @@ protected: virtual UInt8 GetEntityMetadataID(eEntityMetadata a_Metadata); virtual UInt8 GetEntityMetadataID(eEntityMetadataType a_FieldType); virtual std::pair<short, short> GetItemFromProtocolID(UInt32 a_ProtocolID); - virtual UInt32 GetProtocolIDFromItem(short a_ItemID, short a_ItemDamage); + virtual UInt32 GetProtocolBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta); + virtual UInt32 GetProtocolItemType(short a_ItemID, short a_ItemDamage); virtual UInt32 GetProtocolStatisticType(Statistic a_Statistic); virtual bool HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) override; @@ -107,12 +89,10 @@ public: protected: - virtual void SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; - virtual void SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override; - virtual Version GetProtocolVersion() override; virtual std::pair<short, short> GetItemFromProtocolID(UInt32 a_ProtocolID) override; - virtual UInt32 GetProtocolIDFromItem(short a_ItemID, short a_ItemDamage) override; + virtual UInt32 GetProtocolBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta) override; + virtual UInt32 GetProtocolItemType(short a_ItemID, short a_ItemDamage) override; virtual UInt32 GetProtocolStatisticType(Statistic a_Statistic) override; }; |