From 00f8c3a2251833f2d16ec89861a4377029cb2401 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 19 Jul 2020 16:29:49 +0100 Subject: Implement "caching" in ChunkDataSerializer + When sending a chunk to multiple clients, group them by protocol version and send the same data --- src/ChunkSender.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/ChunkSender.cpp') diff --git a/src/ChunkSender.cpp b/src/ChunkSender.cpp index 3c4c565a3..dc0af8647 100644 --- a/src/ChunkSender.cpp +++ b/src/ChunkSender.cpp @@ -245,13 +245,15 @@ void cChunkSender::SendChunk(int a_ChunkX, int a_ChunkZ, std::unordered_setSendChunkData(a_ChunkX, a_ChunkZ, Data); + cChunkDataSerializer Data(a_ChunkX, a_ChunkZ, m_Data, m_BiomeMap, m_World.GetDimension()); + Data.SendToClients(a_Clients); + } + for (const auto Client : a_Clients) + { // Send block-entity packets: for (const auto & Pos : m_BlockEntities) { -- cgit v1.2.3