border light: fix skylight propagation

This commit is contained in:
Bixilon 2022-10-11 14:15:02 +02:00
parent cad6fa8d2b
commit 835f62d1f4
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -107,19 +107,19 @@ class BorderSectionLight(
fun traceSkyIncrease(x: Int, z: Int, nextLevel: Int) {
val index = z shl 4 or x
val currentLight = light[index].toInt() and SectionLight.SKY_LIGHT_MASK shl 4
if (currentLight >= nextLevel) {
val light = light[index].toInt()
if ((light and SectionLight.SKY_LIGHT_MASK shr 4) >= nextLevel) {
// light is already higher, no need to trace
return
}
this.light[index] = ((this.light[index].toInt() and SectionLight.BLOCK_LIGHT_MASK) or nextLevel).toByte()
this.light[index] = ((light and SectionLight.BLOCK_LIGHT_MASK) or (nextLevel shl 4)).toByte()
if (!update) {
update = true
}
if (nextLevel == 1) {
if (nextLevel <= 1) {
return updateY()
}
val neighbourLevel = nextLevel - 1