mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
regions related code moved from WorldFiles to WorldRegions
This commit is contained in:
parent
d2a2f0e8ae
commit
3ebd8f3062
8 changed files with 641 additions and 576 deletions
|
|
@ -51,14 +51,14 @@ static void verifyLoadedChunk(ContentIndices* indices, Chunk* chunk) {
|
|||
|
||||
std::shared_ptr<Chunk> ChunksStorage::create(int x, int z) {
|
||||
World* world = level->getWorld();
|
||||
WorldFiles* wfile = world->wfile.get();
|
||||
auto& regions = world->wfile.get()->getRegions();
|
||||
|
||||
auto chunk = std::make_shared<Chunk>(x, z);
|
||||
store(chunk);
|
||||
auto data = wfile->getChunk(chunk->x, chunk->z);
|
||||
auto data = regions.getChunk(chunk->x, chunk->z);
|
||||
if (data) {
|
||||
chunk->decode(data.get());
|
||||
auto invs = wfile->fetchInventories(chunk->x, chunk->z);
|
||||
auto invs = regions.fetchInventories(chunk->x, chunk->z);
|
||||
chunk->setBlockInventories(std::move(invs));
|
||||
chunk->setLoaded(true);
|
||||
for(auto& entry : chunk->inventories) {
|
||||
|
|
@ -67,7 +67,7 @@ std::shared_ptr<Chunk> ChunksStorage::create(int x, int z) {
|
|||
verifyLoadedChunk(level->content->getIndices(), chunk.get());
|
||||
}
|
||||
|
||||
auto lights = wfile->getLights(chunk->x, chunk->z);
|
||||
auto lights = regions.getLights(chunk->x, chunk->z);
|
||||
if (lights) {
|
||||
chunk->lightmap.set(lights.get());
|
||||
chunk->setLoadedLights(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue