From 7cb97dcfd1956e6a490b877bd0958f9a181ce7bb Mon Sep 17 00:00:00 2001 From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com> Date: Tue, 7 Nov 2023 21:02:56 +0100 Subject: [PATCH] Fixed Bulk Chunk 1.7 <-> 1.8 skylight reading --- .../types/chunk/BulkChunkType1_7_6.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/types/chunk/BulkChunkType1_7_6.java b/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/types/chunk/BulkChunkType1_7_6.java index a8b4dcf6d..f2f09160e 100644 --- a/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/types/chunk/BulkChunkType1_7_6.java +++ b/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/types/chunk/BulkChunkType1_7_6.java @@ -1,6 +1,7 @@ package com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.types.chunk; import com.viaversion.viaversion.api.minecraft.chunks.Chunk; +import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.util.Pair; import io.netty.buffer.ByteBuf; @@ -55,7 +56,18 @@ public void write(ByteBuf byteBuf, Chunk[] chunks) throws Exception { byteBuf.writeShort(chunkCount); byteBuf.writeInt(compressedSize); - byteBuf.writeBoolean(true); // hasSkyLight + + boolean skyLight = false; + for (Chunk chunk : chunks) { + for (ChunkSection section : chunk.getSections()) { + if (section != null && section.getLight().hasSkyLight()) { + skyLight = true; + break; + } + } + } + + byteBuf.writeBoolean(skyLight); // hasSkyLight byteBuf.writeBytes(compressedData, 0, compressedSize); for (int i = 0; i < chunkCount; i++) {