From 188a71ad5b148f9534455c013211190e839ee3f1 Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Wed, 14 Nov 2012 11:22:15 -0600 Subject: [PATCH] Clear out empty extended block ID array. Fixes BUKKIT-2923 If a chunk gets a block added to it that requires the extended block id nibble array (block id greater than 255) the array is created and saved with the chunk. When the blocks are verified to make sure they exist these entries are erased but the extended block id array is not. This causes the server and client to disagree about how much data a chunk has which makes the client crash while trying to load the chunk for rendering. To resolve these issues we now clear the extended block id array on chunk load if there is no valid data in it. --- .../java/net/minecraft/server/ChunkSection.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java index 60d2a73c31..31262a3535 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java @@ -219,6 +219,20 @@ public class ChunkSection { } public void a(NibbleArray nibblearray) { + // CraftBukkit start - don't hang on to an empty nibble array + boolean empty = true; + for (int i = 0; i < nibblearray.a.length; i++) { + if (nibblearray.a[i] != 0) { + empty = false; + break; + } + } + + if (empty) { + return; + } + // CraftBukkit end + this.extBlockIds = nibblearray; }