summaryrefslogtreecommitdiffstats
path: root/nms-patches/ChunkRegionLoader.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nms-patches/ChunkRegionLoader.patch')
-rw-r--r--nms-patches/ChunkRegionLoader.patch42
1 files changed, 36 insertions, 6 deletions
diff --git a/nms-patches/ChunkRegionLoader.patch b/nms-patches/ChunkRegionLoader.patch
index 24a40d6e..75aeb037 100644
--- a/nms-patches/ChunkRegionLoader.patch
+++ b/nms-patches/ChunkRegionLoader.patch
@@ -1,5 +1,5 @@
---- ../work/decompile-8eb82bde//net/minecraft/server/ChunkRegionLoader.java 2014-11-28 17:43:42.985707437 +0000
-+++ src/main/java/net/minecraft/server/ChunkRegionLoader.java 2014-11-28 17:38:17.000000000 +0000
+--- ../work/decompile-8eb82bde//net/minecraft/server/ChunkRegionLoader.java 2014-11-29 23:25:09.296846856 +0000
++++ src/main/java/net/minecraft/server/ChunkRegionLoader.java 2014-11-29 23:24:59.400847076 +0000
@@ -23,8 +23,40 @@
public ChunkRegionLoader(File file) {
this.e = file;
@@ -18,11 +18,11 @@
+ }
+ }
+ }
-+
+
+ return RegionFileCache.a(this.e, i, j).chunkExists(i & 31, j & 31);
+ }
+ // CraftBukkit end
-
++
+ // CraftBukkit start - Add async variant, provide compatibility
public Chunk a(World world, int i, int j) {
+ Object[] data = loadChunk(world, i, j);
@@ -107,7 +107,37 @@
DataOutputStream dataoutputstream = RegionFileCache.d(this.e, pendingchunktosave.a.x, pendingchunktosave.a.z);
NBTCompressedStreamTools.a(pendingchunktosave.b, (DataOutput) dataoutputstream);
-@@ -320,7 +376,13 @@
+@@ -302,8 +358,27 @@
+ int j1 = l >> 8 & 15;
+ int k1 = l >> 4 & 15;
+ int l1 = nibblearray1 != null ? nibblearray1.a(i1, j1, k1) : 0;
+-
+- achar[l] = (char) (l1 << 12 | (abyte[l] & 255) << 4 | nibblearray.a(i1, j1, k1));
++
++ // CraftBukkit start - fix broken blocks
++ // achar[l] = (char) (l1 << 12 | (abyte[l] & 255) << 4 | nibblearray.a(i1, j1, k1));
++
++ int ex = l1;
++ int id = (abyte[l] & 255);
++ int data = nibblearray.a(i1, j1, k1);
++ int packed = ex << 12 | id << 4 | data;
++ if (Block.d.a(packed) == null) {
++ Block block = Block.getById(ex << 8 | id);
++ if (block != null) {
++ try {
++ data = block.toLegacyData(block.fromLegacyData(data));
++ } catch (Exception ignored) {
++ data = block.toLegacyData(block.getBlockData());
++ }
++ packed = ex << 12 | id << 4 | data;
++ }
++ }
++ achar[l] = (char) packed;
++ // CraftBukkit end
+ }
+
+ chunksection.a(achar);
+@@ -320,7 +395,13 @@
if (nbttagcompound.hasKeyOfType("Biomes", 7)) {
chunk.a(nbttagcompound.getByteArray("Biomes"));
}
@@ -121,7 +151,7 @@
NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10);
if (nbttaglist1 != null) {
-@@ -379,6 +441,6 @@
+@@ -379,6 +460,6 @@
}
}