From e7ecda64f00d4b9d6a7ffc6201b142a84cc265be Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 23 Nov 2021 11:21:54 -0500 Subject: [PATCH] Use new 1.18 chunk encoding features --- .../JavaLevelChunkWithLightTranslator.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java index 4a749c6d3..127cae9ab 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java @@ -43,6 +43,7 @@ import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtUtils; import com.nukkitx.network.VarInts; import com.nukkitx.protocol.bedrock.packet.LevelChunkPacket; +import com.nukkitx.protocol.bedrock.v475.Bedrock_v475; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.ByteBufOutputStream; @@ -325,9 +326,19 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator= Bedrock_v475.V475_CODEC.getProtocolVersion()) { + int remainingEmptyBiomes = 25 - sectionCount; + for (int i = 0; i < remainingEmptyBiomes; i++) { + // A header that says to carry on the biome data from the previous chunk + // This notably fixes biomes in the End + byteBuf.writeByte((127 << 1) | 1); + } + } else { + int remainingEmptyBiomes = 32 - sectionCount; + for (int i = 0; i < remainingEmptyBiomes; i++) { + byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA); + } } byteBuf.writeByte(0); // Border blocks - Edu edition only