From f67949dbc4610212d3441e5a20c9ffa984d09369 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 13 Aug 2023 17:09:03 -0500 Subject: [PATCH] Fix DhLightingEngine for light positions outside the chunk(s) --- .../distanthorizons/core/generation/DhLightingEngine.java | 7 +++++++ 1 file changed, 7 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 ac2e674b1..42ba358e4 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 @@ -179,6 +179,13 @@ public class DhLightingEngine continue; } + if (relNeighbourBlockPos.y < neighbourChunk.getMinBuildHeight() || relNeighbourBlockPos.y > neighbourChunk.getMaxBuildHeight()) + { + // the light pos is outside the chunk's min/max height, + // this can happen if given a chunk that hasn't finished generating + continue; + } + int currentBlockLight = getLightFunc.getLight(neighbourChunk, relNeighbourBlockPos); if (currentBlockLight >= (lightValue - 1))