From 1002ca401613294db2ecc06ed35a575c483ce41b Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Wed, 11 Dec 2019 20:36:49 +0100 Subject: [PATCH] Fix biomedata on some custom Spigot versions --- .../packets/WorldPackets.java | 24 ++++++++++--------- 1 file changed, 13 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 77cd2cf22..a3578e146 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 @@ -101,18 +101,20 @@ public class WorldPackets { if (chunk.isGroundUp()) { int[] biomeData = chunk.getBiomeData(); int[] newBiomeData = new int[1024]; - // 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]; + if (biomeData != null) { + // 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); } - } - // ... 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);