From 835f62d1f4cfbff193e584ef2271b167ca873860 Mon Sep 17 00:00:00 2001 From: Bixilon Date: Tue, 11 Oct 2022 14:15:02 +0200 Subject: [PATCH] border light: fix skylight propagation --- .../minosoft/data/world/chunk/light/BorderSectionLight.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/bixilon/minosoft/data/world/chunk/light/BorderSectionLight.kt b/src/main/java/de/bixilon/minosoft/data/world/chunk/light/BorderSectionLight.kt index d129cba68..1212af303 100644 --- a/src/main/java/de/bixilon/minosoft/data/world/chunk/light/BorderSectionLight.kt +++ b/src/main/java/de/bixilon/minosoft/data/world/chunk/light/BorderSectionLight.kt @@ -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