fix possible run condition
This commit is contained in:
parent
3edd271b81
commit
0a5a72b8fe
1 changed files with 2 additions and 0 deletions
|
@ -232,6 +232,7 @@ xe::Model* Chunk::getMesh() {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Chunk::getBlock(int32_t x, int32_t y, int32_t z) {
|
uint8_t Chunk::getBlock(int32_t x, int32_t y, int32_t z) {
|
||||||
|
if(!generated) return INVALID;
|
||||||
if(y > 256) return AIR;
|
if(y > 256) return AIR;
|
||||||
if(y < 0) return INVALID;
|
if(y < 0) return INVALID;
|
||||||
int chunkX = gridX;
|
int chunkX = gridX;
|
||||||
|
@ -263,6 +264,7 @@ uint8_t Chunk::getBlock(int32_t x, int32_t y, int32_t z) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chunk::setBlock(int32_t x, int32_t y, int32_t z, uint8_t block) {
|
void Chunk::setBlock(int32_t x, int32_t y, int32_t z, uint8_t block) {
|
||||||
|
if(!generated) return;
|
||||||
int index = x + (z * 16) + (y * 256);
|
int index = x + (z * 16) + (y * 256);
|
||||||
cubes[index] = block;
|
cubes[index] = block;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue