From 4f3aaecae2e86c725d26adad47d989b4619d2929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20=C5=A0okala?= Date: Tue, 9 Jun 2026 17:10:10 +0200 Subject: [PATCH] Reduce getWorldBlockLightPosList() work for 1.12.2 by skipping empty chunk sections --- .../common/wrappers/chunk/ChunkWrapper.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java index d6fc4fe41..ac8bd21cc 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java @@ -731,16 +731,25 @@ public class ChunkWrapper implements IChunkWrapper //1.12.2 doesn't store lights we must bruteforce it #if MC_VER <= MC_1_12_2 - for (int x = 0; x < 16; x++) - { - for (int z = 0; z < 16; z++) + for (ExtendedBlockStorage section : this.chunk.getBlockStorageArray()) { + if (section == null || section.isEmpty()) { - for (int y = 0; y < 256; y++) + continue; + } + + int baseY = section.getYLocation(); + + for (int x = 0; x < 16; x++) + { + for (int z = 0; z < 16; z++) { - IBlockState blockState = this.chunk.getBlockState(x, y, z); - if (blockState.getLightValue() > 0) + for (int y = 0; y < 16; y++) { - this.blockLightPosList.add(new DhBlockPos(this.chunk.getPos().getXStart() + x, y, this.chunk.getPos().getZStart() + z)); + IBlockState blockState = section.get(x, y, z); + if (blockState.getLightValue() > 0) + { + this.blockLightPosList.add(new DhBlockPos(this.chunk.getPos().getXStart() + x, baseY + y, this.chunk.getPos().getZStart() + z)); + } } } }