From 68a18df9698ab41bf85d5392e6cc0a8fad2e90f9 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Sat, 7 Dec 2019 11:31:00 +0100 Subject: [PATCH] Take biome data from same indexes as Mojang ("middle" of 4x4x4 areas) --- .../packets/WorldPackets.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java index 285e9d9bb..081ca09d7 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java @@ -86,19 +86,19 @@ public class WorldPackets { if (chunk.isGroundUp()) { int[] biomeData = chunk.getBiomeData(); int[] newBiomeData = new int[1024]; - // Now in 4x4x4 areas (x, then z, then y) - // Set the x/z data - int i = 0; - for (int z = 1; z <= 16; z += 4) { - for (int x = 1; x <= 16; x += 4) { - int biome = biomeData[(x * z) - 1]; - // Extend it on the y axis - for (int y = 0; y < 1024; y += 16) { - newBiomeData[i + y] = biome; - } - i++; + // Now in 4x4x4 areas - take the biome of each "middle" + for (int i = 0; i < 4; ++i) { + for (int j = 0; j < 4; ++j) { + int x = (j << 2) + 2; + int z = (i << 2) + 2; + int oldIndex = (z << 4 | x); + newBiomeData[i << 2 | j] = biomeData[oldIndex]; } } + // ... and copy it to the new y layers + for (int i = 1; i < 64; ++i) { + System.arraycopy(newBiomeData, 0, newBiomeData, i * 16, 16); + } chunk.setBiomeData(newBiomeData); }