From eb749d6bb04bdbd96b121af05bbd68780089afb0 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 18 Nov 2024 07:46:24 -0600 Subject: [PATCH] Fix a rare error where chunk lighting is set to -1 --- .../distanthorizons/core/generation/DhLightingEngine.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java b/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java index 8a1584a73..f2448593e 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java @@ -246,6 +246,10 @@ public class DhLightingEngine // block light if (updateBlockLight) { + // done to prevent a rare issue where the light values are incorrectly set to -1 + // TODO why could that happen? + centerChunk.clearDhBlockLighting(); + this.propagateChunkLightPosList(blockLightWorldPosQueue, adjacentChunkHolder, (neighbourChunk, relBlockPos) -> neighbourChunk.getDhBlockLight(relBlockPos.getX(), relBlockPos.getY(), relBlockPos.getZ()), (neighbourChunk, relBlockPos, newLightValue) -> neighbourChunk.setDhBlockLight(relBlockPos.getX(), relBlockPos.getY(), relBlockPos.getZ(), newLightValue), @@ -255,6 +259,8 @@ public class DhLightingEngine // sky light if (updateSkyLight) { + centerChunk.clearDhSkyLighting(); + this.propagateChunkLightPosList(skyLightWorldPosQueue, adjacentChunkHolder, (neighbourChunk, relBlockPos) -> neighbourChunk.getDhSkyLight(relBlockPos.getX(), relBlockPos.getY(), relBlockPos.getZ()), (neighbourChunk, relBlockPos, newLightValue) -> neighbourChunk.setDhSkyLight(relBlockPos.getX(), relBlockPos.getY(), relBlockPos.getZ(), newLightValue),