1
0

Prepare ChunkData for BlockState storage (#5105)

* Rename ChunkData Creatable test

* Add missing Y-check in RedstoneWireHandler

* Remove ChunkDef.h dependency in Scoreboard

* Prepare ChunkData for BlockState storage

+ Split chunk block, meta, block & sky light storage
+ Load the height map from disk
- Reduce duplicated code in ChunkData
- Remove saving MCSBiomes, there aren't any
- Remove the allocation pool, ref #4315, #3864

* fixed build

* fixed test

* fixed the debug compile

Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com>
This commit is contained in:
Tiger Wang
2021-03-05 13:03:55 +00:00
committed by GitHub
parent 5fa45182e8
commit 868cd94ee9
39 changed files with 1106 additions and 2203 deletions

View File

@@ -238,7 +238,7 @@ void cChunkSender::SendChunk(int a_ChunkX, int a_ChunkZ, const WeakClients & a_C
}
// Send:
m_Serializer.SendToClients(a_ChunkX, a_ChunkZ, m_Data, m_BiomeMap, Clients);
m_Serializer.SendToClients(a_ChunkX, a_ChunkZ, m_BlockData, m_LightData, m_BiomeMap, Clients);
for (const auto & Client : Clients)
{
@@ -276,7 +276,7 @@ void cChunkSender::SendChunk(int a_ChunkX, int a_ChunkZ, const WeakClients & a_C
});
}
}
m_Data.Clear();
m_BlockEntities.clear();
m_EntityIDs.clear();
}
@@ -303,14 +303,14 @@ void cChunkSender::Entity(cEntity * a_Entity)
void cChunkSender::BiomeData(const cChunkDef::BiomeMap * a_BiomeMap)
void cChunkSender::BiomeMap(const cChunkDef::BiomeMap & a_BiomeMap)
{
for (size_t i = 0; i < ARRAYCOUNT(m_BiomeMap); i++)
{
if ((*a_BiomeMap)[i] < 255)
if (a_BiomeMap[i] < 255)
{
// Normal MC biome, copy as-is:
m_BiomeMap[i] = static_cast<unsigned char>((*a_BiomeMap)[i]);
m_BiomeMap[i] = static_cast<unsigned char>(a_BiomeMap[i]);
}
else
{
@@ -319,7 +319,3 @@ void cChunkSender::BiomeData(const cChunkDef::BiomeMap * a_BiomeMap)
}
} // for i - m_BiomeMap[]
}