Handle uniform block ids greater than 127. Fixes BUKKIT-5686

This commit is contained in:
Travis Watkins 2014-07-10 19:19:48 -05:00
parent 13482ac7f6
commit 319a9c20eb

View File

@ -13,7 +13,7 @@ public class ChunkSection {
private NibbleArray emittedLight; private NibbleArray emittedLight;
private NibbleArray skyLight; private NibbleArray skyLight;
// CraftBukkit start - Compact storage // CraftBukkit start - Compact storage
private byte compactId; private int compactId;
private byte compactExtId; private byte compactExtId;
private byte compactData; private byte compactData;
private byte compactEmitted; private byte compactEmitted;
@ -125,7 +125,7 @@ public class ChunkSection {
// CraftBukkit start - Compact storage // CraftBukkit start - Compact storage
if (this.blockIds == null) { if (this.blockIds == null) {
this.blockIds = new byte[4096]; this.blockIds = new byte[4096];
Arrays.fill(this.blockIds, this.compactId); Arrays.fill(this.blockIds, (byte) (this.compactId & 255));
} }
// CraftBukkit end // CraftBukkit end
@ -351,7 +351,7 @@ public class ChunkSection {
// CraftBukkit start - Compact storage // CraftBukkit start - Compact storage
if (this.blockIds == null) { if (this.blockIds == null) {
byte[] ids = new byte[4096]; byte[] ids = new byte[4096];
Arrays.fill(ids, this.compactId); Arrays.fill(ids, (byte) (this.compactId & 255));
return ids; return ids;
} }
// CraftBukkit end // CraftBukkit end
@ -401,7 +401,7 @@ public class ChunkSection {
this.blockIds = null; this.blockIds = null;
return; return;
} else if (canBeCompact(abyte)) { } else if (canBeCompact(abyte)) {
this.compactId = abyte[0]; this.compactId = abyte[0] & 255;
return; return;
} }
// CraftBukkit end // CraftBukkit end