|
@@ -575,10 +575,9 @@ void Chunk::setNeighbor(Direction dir, Chunk* zChunk)
|
|
|
if (dir == NORTH)
|
|
|
{
|
|
|
int index = i * CHUNK_SIZE * WORLD_HEIGHT + z;
|
|
|
+ int j = (i * CHUNK_SIZE + CHUNK_SIZE - 1) * WORLD_HEIGHT + z;
|
|
|
if (blocks[index])
|
|
|
{
|
|
|
- int j
|
|
|
- = (i * CHUNK_SIZE + CHUNK_SIZE - 1) * WORLD_HEIGHT + z;
|
|
|
if (zChunk && zChunk->blocks[j])
|
|
|
blocks[index]->setNeighbour(NORTH, zChunk->blocks[j]);
|
|
|
else
|
|
@@ -588,14 +587,22 @@ void Chunk::setNeighbor(Direction dir, Chunk* zChunk)
|
|
|
NORTH, zChunk ? zChunk->blockIds[j] : 0);
|
|
|
}
|
|
|
}
|
|
|
+ else if (zChunk)
|
|
|
+ {
|
|
|
+ if (zChunk->blockIds[j] == BlockTypeEnum::AIR
|
|
|
+ && !blockIds[index])
|
|
|
+ {
|
|
|
+ generateBlock(Vec3<int>(i, 0, z));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
else if (dir == EAST)
|
|
|
{
|
|
|
int index
|
|
|
= ((CHUNK_SIZE - 1) * CHUNK_SIZE + i) * WORLD_HEIGHT + z;
|
|
|
+ int j = i * WORLD_HEIGHT + z;
|
|
|
if (blocks[index])
|
|
|
{
|
|
|
- int j = i * WORLD_HEIGHT + z;
|
|
|
if (zChunk && zChunk->blocks[j])
|
|
|
blocks[index]->setNeighbour(EAST, zChunk->blocks[j]);
|
|
|
else
|
|
@@ -605,14 +612,22 @@ void Chunk::setNeighbor(Direction dir, Chunk* zChunk)
|
|
|
EAST, zChunk ? zChunk->blockIds[j] : 0);
|
|
|
}
|
|
|
}
|
|
|
+ else if (zChunk)
|
|
|
+ {
|
|
|
+ if (zChunk->blockIds[j] == BlockTypeEnum::AIR
|
|
|
+ && !blockIds[index])
|
|
|
+ {
|
|
|
+ generateBlock(Vec3<int>(CHUNK_SIZE - 1, i, z));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
else if (dir == SOUTH)
|
|
|
{
|
|
|
int index
|
|
|
= (i * CHUNK_SIZE + CHUNK_SIZE - 1) * WORLD_HEIGHT + z;
|
|
|
+ int j = i * CHUNK_SIZE * WORLD_HEIGHT + z;
|
|
|
if (blocks[index])
|
|
|
{
|
|
|
- int j = i * CHUNK_SIZE * WORLD_HEIGHT + z;
|
|
|
if (zChunk && zChunk->blocks[j])
|
|
|
blocks[index]->setNeighbour(SOUTH, zChunk->blocks[j]);
|
|
|
else
|
|
@@ -622,14 +637,21 @@ void Chunk::setNeighbor(Direction dir, Chunk* zChunk)
|
|
|
SOUTH, zChunk ? zChunk->blockIds[j] : 0);
|
|
|
}
|
|
|
}
|
|
|
+ else if (zChunk)
|
|
|
+ {
|
|
|
+ if (zChunk->blockIds[j] == BlockTypeEnum::AIR
|
|
|
+ && !blockIds[index])
|
|
|
+ {
|
|
|
+ generateBlock(Vec3<int>(i, CHUNK_SIZE - 1, z));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
else if (dir == WEST)
|
|
|
{
|
|
|
int index = i * WORLD_HEIGHT + z;
|
|
|
+ int j = ((CHUNK_SIZE - 1) * CHUNK_SIZE + i) * WORLD_HEIGHT + z;
|
|
|
if (blocks[index])
|
|
|
{
|
|
|
- int j = ((CHUNK_SIZE - 1) * CHUNK_SIZE + i) * WORLD_HEIGHT
|
|
|
- + z;
|
|
|
if (zChunk && zChunk->blocks[j])
|
|
|
blocks[index]->setNeighbour(WEST, zChunk->blocks[j]);
|
|
|
else
|
|
@@ -639,6 +661,14 @@ void Chunk::setNeighbor(Direction dir, Chunk* zChunk)
|
|
|
WEST, zChunk ? zChunk->blockIds[j] : 0);
|
|
|
}
|
|
|
}
|
|
|
+ else if (zChunk)
|
|
|
+ {
|
|
|
+ if (zChunk->blockIds[j] == BlockTypeEnum::AIR
|
|
|
+ && !blockIds[index])
|
|
|
+ {
|
|
|
+ generateBlock(Vec3<int>(0, i, z));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|