mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add player.is_loading_chunks, .set_loading_chunks
This commit is contained in:
parent
0940e899cf
commit
e153e1fbd7
6 changed files with 54 additions and 2 deletions
|
|
@ -38,7 +38,9 @@ void ChunksController::update(
|
|||
int centerX = floordiv<CHUNK_W>(position.x);
|
||||
int centerY = floordiv<CHUNK_D>(position.z);
|
||||
|
||||
generator->update(centerX, centerY, loadDistance);
|
||||
if (player.isLoadingChunks()) {
|
||||
generator->update(centerX, centerY, loadDistance);
|
||||
}
|
||||
|
||||
int64_t mcstotal = 0;
|
||||
|
||||
|
|
@ -121,6 +123,12 @@ bool ChunksController::buildLights(const Player& player, const std::shared_ptr<C
|
|||
}
|
||||
|
||||
void ChunksController::createChunk(const Player& player, int x, int z) const {
|
||||
if (!player.isLoadingChunks()) {
|
||||
if (auto chunk = level.chunks->fetch(x, z)) {
|
||||
player.chunks->putChunk(chunk);
|
||||
}
|
||||
return;
|
||||
}
|
||||
auto chunk = level.chunks->create(x, z);
|
||||
player.chunks->putChunk(chunk);
|
||||
auto& chunkFlags = chunk->flags;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue