diff options
author | Thinkofdeath <thinkofdeath@spigotmc.org> | 2015-02-26 22:41:06 +0000 |
---|---|---|
committer | Thinkofdeath <thinkofdeath@spigotmc.org> | 2015-03-04 09:48:58 +0000 |
commit | d8a9c7be4227b2243968b63ab7cc7a00098c93ad (patch) | |
tree | 554a08a5f23ffa5dd66a28247d6358515b1ffb7a /nms-patches/ChunkRegionLoader.patch | |
parent | 33d5de312e9fcc8aec3fc53136658cb6920562aa (diff) | |
download | craftbukkit-d8a9c7be4227b2243968b63ab7cc7a00098c93ad.tar craftbukkit-d8a9c7be4227b2243968b63ab7cc7a00098c93ad.tar.gz craftbukkit-d8a9c7be4227b2243968b63ab7cc7a00098c93ad.tar.lz craftbukkit-d8a9c7be4227b2243968b63ab7cc7a00098c93ad.tar.xz craftbukkit-d8a9c7be4227b2243968b63ab7cc7a00098c93ad.zip |
Update to Minecraft 1.8.3
Diffstat (limited to 'nms-patches/ChunkRegionLoader.patch')
-rw-r--r-- | nms-patches/ChunkRegionLoader.patch | 121 |
1 files changed, 46 insertions, 75 deletions
diff --git a/nms-patches/ChunkRegionLoader.patch b/nms-patches/ChunkRegionLoader.patch index 75aeb037..d9776753 100644 --- a/nms-patches/ChunkRegionLoader.patch +++ b/nms-patches/ChunkRegionLoader.patch @@ -1,10 +1,9 @@ ---- ../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) { +--- /home/matt/mc-dev-private//net/minecraft/server/ChunkRegionLoader.java 2015-02-26 22:40:22.327608142 +0000 ++++ src/main/java/net/minecraft/server/ChunkRegionLoader.java 2015-02-26 22:40:22.331608142 +0000 +@@ -25,7 +25,39 @@ this.e = file; } -+ + + // CraftBukkit start + public boolean chunkExists(World world, int i, int j) { + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); @@ -18,13 +17,13 @@ + } + } + } - ++ + 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) { + public Chunk a(World world, int i, int j) throws IOException { + Object[] data = loadChunk(world, i, j); + if (data != null) { + Chunk chunk = (Chunk) data[0]; @@ -32,16 +31,16 @@ + loadEntities(chunk, nbttagcompound.getCompound("Level"), world); + return chunk; + } -+ ++ + return null; + } -+ -+ public Object[] loadChunk(World world, int i, int j) { ++ ++ public Object[] loadChunk(World world, int i, int j) throws IOException { + // CraftBukkit end NBTTagCompound nbttagcompound = null; ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); Object object = this.d; -@@ -53,7 +85,7 @@ +@@ -54,7 +86,7 @@ return this.a(world, i, j, nbttagcompound); } @@ -50,73 +49,44 @@ if (!nbttagcompound.hasKeyOfType("Level", 10)) { ChunkRegionLoader.a.error("Chunk file at " + i + "," + j + " is missing level data, skipping"); return null; -@@ -64,18 +96,42 @@ - Chunk chunk = this.a(world, nbttagcompound.getCompound("Level")); - - if (!chunk.a(i, j)) { -- ChunkRegionLoader.a.error("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.locX + ", " + chunk.locZ + ")"); -- nbttagcompound.setInt("xPos", i); -- nbttagcompound.setInt("zPos", j); -+ a.error("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.locX + ", " + chunk.locZ + ")"); -+ nbttagcompound.getCompound("Level").setInt("xPos", i); -+ nbttagcompound.getCompound("Level").setInt("zPos", j); -+ -+ // CraftBukkit start - Have to move tile entities since we don't load them at this stage -+ NBTTagList tileEntities = nbttagcompound.getCompound("Level").getList("TileEntities", 10); -+ if (tileEntities != null) { -+ for (int te = 0; te < tileEntities.size(); te++) { -+ NBTTagCompound tileEntity = (NBTTagCompound) tileEntities.get(te); -+ int x = tileEntity.getInt("x") - chunk.locX * 16; -+ int z = tileEntity.getInt("z") - chunk.locZ * 16; -+ tileEntity.setInt("x", i * 16 + x); -+ tileEntity.setInt("z", j * 16 + z); +@@ -71,10 +103,28 @@ + ChunkRegionLoader.a.error("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.locX + ", " + chunk.locZ + ")"); + nbttagcompound1.setInt("xPos", i); + nbttagcompound1.setInt("zPos", j); ++ ++ // CraftBukkit start - Have to move tile entities since we don't load them at this stage ++ NBTTagList tileEntities = nbttagcompound.getCompound("Level").getList("TileEntities", 10); ++ if (tileEntities != null) { ++ for (int te = 0; te < tileEntities.size(); te++) { ++ NBTTagCompound tileEntity = (NBTTagCompound) tileEntities.get(te); ++ int x = tileEntity.getInt("x") - chunk.locX * 16; ++ int z = tileEntity.getInt("z") - chunk.locZ * 16; ++ tileEntity.setInt("x", i * 16 + x); ++ tileEntity.setInt("z", j * 16 + z); ++ } + } -+ } ++ // CraftBukkit end + chunk = this.a(world, nbttagcompound1); + } + +- return chunk; ++ // CraftBukkit start ++ Object[] data = new Object[2]; ++ data[0] = chunk; ++ data[1] = nbttagcompound; ++ return data; + // CraftBukkit end - chunk = this.a(world, nbttagcompound.getCompound("Level")); } - -- return chunk; -+ // CraftBukkit start -+ Object[] data = new Object[2]; -+ data[0] = chunk; -+ data[1] = nbttagcompound; -+ return data; -+ // CraftBukkit end } } - - public void a(World world, Chunk chunk) { -- world.checkSession(); -+ // CraftBukkit start - "handle" exception -+ try { -+ world.checkSession(); -+ } catch (ExceptionWorldConflict ex) { -+ ex.printStackTrace(); -+ } -+ // CraftBukkit end - - try { - NBTTagCompound nbttagcompound = new NBTTagCompound(); -@@ -133,7 +189,7 @@ - return true; - } - -- public void a(PendingChunkToSave pendingchunktosave) { -+ public void a(PendingChunkToSave pendingchunktosave) throws java.io.IOException { // CraftBukkit - added throws - DataOutputStream dataoutputstream = RegionFileCache.d(this.e, pendingchunktosave.a.x, pendingchunktosave.a.z); - - NBTCompressedStreamTools.a(pendingchunktosave.b, (DataOutput) dataoutputstream); -@@ -302,8 +358,27 @@ - int j1 = l >> 8 & 15; +@@ -308,7 +358,26 @@ 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); @@ -137,25 +107,26 @@ } chunksection.a(achar); -@@ -320,7 +395,13 @@ - if (nbttagcompound.hasKeyOfType("Biomes", 7)) { +@@ -326,6 +395,13 @@ chunk.a(nbttagcompound.getByteArray("Biomes")); } -+ + + // CraftBukkit start - End this method here and split off entity loading to another method + return chunk; + } - ++ + public void loadEntities(Chunk chunk, NBTTagCompound nbttagcompound, World world) { + // CraftBukkit end ++ NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10); if (nbttaglist1 != null) { -@@ -379,6 +460,6 @@ +@@ -384,7 +460,7 @@ } } - return chunk; -+ // return chunk; // CraftBukkit ++ // return chunk; // CraftBukkit } - } + + static class PendingChunkToSave { |