fix some skylight bugs

This commit is contained in:
Bixilon 2023-01-28 20:21:06 +01:00
parent 8974a31371
commit a2624c4c43
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -364,17 +364,17 @@ class SectionLight(
if (target != Directions.UP && (target == null || lightProperties.propagatesLight(Directions.DOWN))) {
if (y > 0) {
traceSkylightIncrease(x, y - 1, z, nextNeighbourLevel, Directions.DOWN, totalY - 1)
} else if (section.sectionHeight != chunk.maxSection) {
(neighbours[Directions.O_DOWN] ?: chunk.getOrPut(section.sectionHeight + 1, false))?.light?.traceSkylightIncrease(x, ProtocolDefinition.SECTION_MAX_Y, z, nextNeighbourLevel, Directions.DOWN, totalY - 1)
} else if (section.sectionHeight == chunk.minSection) {
chunk.light.bottom.traceSkyIncrease(x, z, nextLevel)
} else {
(neighbours[Directions.O_DOWN] ?: chunk.getOrPut(section.sectionHeight - 1, false))?.light?.traceSkylightIncrease(x, ProtocolDefinition.SECTION_MAX_Y, z, nextNeighbourLevel, Directions.DOWN, totalY - 1)
}
}
if (target != Directions.DOWN && target != null && (lightProperties.propagatesLight(Directions.UP))) {
if (y < ProtocolDefinition.SECTION_MAX_Y) {
traceSkylightIncrease(x, y + 1, z, nextNeighbourLevel, Directions.UP, totalY + 1)
} else if (section.sectionHeight == chunk.minSection) {
chunk.light.bottom.traceSkyIncrease(x, z, nextLevel)
} else {
(neighbours[Directions.O_UP] ?: chunk.getOrPut(section.sectionHeight - 1, false))?.light?.traceSkylightIncrease(x, 0, z, nextNeighbourLevel, Directions.UP, totalY + 1)
} else if (section.sectionHeight < chunk.maxSection) {
(neighbours[Directions.O_UP] ?: chunk.getOrPut(section.sectionHeight + 1, false))?.light?.traceSkylightIncrease(x, 0, z, nextNeighbourLevel, Directions.UP, totalY + 1)
}
}
if (target != Directions.SOUTH && (target == null || lightProperties.propagatesLight(Directions.NORTH))) {