summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorTravis Watkins <amaranth@ubuntu.com>2012-11-14 11:22:15 -0600
committerTravis Watkins <amaranth@ubuntu.com>2012-11-14 11:36:06 -0600
commit188a71ad5b148f9534455c013211190e839ee3f1 (patch)
tree308bd0b01038d2483625a3dec1e629a86100517f /src/main/java
parent2b22ae2d457a152db547df93ba8f915c24093b7b (diff)
downloadcraftbukkit-188a71ad5b148f9534455c013211190e839ee3f1.tar
craftbukkit-188a71ad5b148f9534455c013211190e839ee3f1.tar.gz
craftbukkit-188a71ad5b148f9534455c013211190e839ee3f1.tar.lz
craftbukkit-188a71ad5b148f9534455c013211190e839ee3f1.tar.xz
craftbukkit-188a71ad5b148f9534455c013211190e839ee3f1.zip
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.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/net/minecraft/server/ChunkSection.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java
index 60d2a73c..31262a35 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;
}