1
0

Implement "caching" in ChunkDataSerializer

+ When sending a chunk to multiple clients, group them by protocol version and send the same data
This commit is contained in:
Tiger Wang
2020-07-19 16:29:49 +01:00
parent bedddfffbc
commit 00f8c3a225
9 changed files with 123 additions and 203 deletions

View File

@@ -245,13 +245,15 @@ void cChunkSender::SendChunk(int a_ChunkX, int a_ChunkZ, std::unordered_set<cCli
{
return;
}
cChunkDataSerializer Data(m_Data, m_BiomeMap, m_World.GetDimension());
{
// Send:
cChunkDataSerializer Data(a_ChunkX, a_ChunkZ, m_Data, m_BiomeMap, m_World.GetDimension());
Data.SendToClients(a_Clients);
}
for (const auto Client : a_Clients)
{
// Send:
Client->SendChunkData(a_ChunkX, a_ChunkZ, Data);
// Send block-entity packets:
for (const auto & Pos : m_BlockEntities)
{