fix skylight propagation through neighbours

This commit is contained in:
Bixilon 2022-09-27 08:38:00 +02:00
parent ca7973017d
commit 663ca98dfb
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -530,25 +530,25 @@ class Chunk(
if (x > 0) { if (x > 0) {
skylightHeightmap[heightmapIndex - 1] skylightHeightmap[heightmapIndex - 1]
} else { } else {
neighbours[ChunkNeighbours.EAST].skylightHeightmap[(z shl 4) or ProtocolDefinition.SECTION_MAX_X] neighbours[ChunkNeighbours.WEST].skylightHeightmap[(z shl 4) or ProtocolDefinition.SECTION_MAX_X]
}, },
if (x < ProtocolDefinition.SECTION_MAX_X) { if (x < ProtocolDefinition.SECTION_MAX_X) {
skylightHeightmap[heightmapIndex + 1] skylightHeightmap[heightmapIndex + 1]
} else { } else {
neighbours[ChunkNeighbours.WEST].skylightHeightmap[(z shl 4) or 0] neighbours[ChunkNeighbours.EAST].skylightHeightmap[(z shl 4) or 0]
}, },
if (z > 0) { if (z > 0) {
skylightHeightmap[((z - 1) shl 4) or x] skylightHeightmap[((z - 1) shl 4) or x]
} else { } else {
neighbours[ChunkNeighbours.SOUTH].skylightHeightmap[(ProtocolDefinition.SECTION_MAX_Z shl 4) or x] neighbours[ChunkNeighbours.NORTH].skylightHeightmap[(ProtocolDefinition.SECTION_MAX_Z shl 4) or x]
}, },
if (z < ProtocolDefinition.SECTION_MAX_Z) { if (z < ProtocolDefinition.SECTION_MAX_Z) {
skylightHeightmap[((z + 1) shl 4) or x] skylightHeightmap[((z + 1) shl 4) or x]
} else { } else {
neighbours[ChunkNeighbours.NORTH].skylightHeightmap[(0 shl 4) or x] neighbours[ChunkNeighbours.SOUTH].skylightHeightmap[(0 shl 4) or x]
} }
) )