diff options
author | md_5 <git@md-5.net> | 2016-05-22 11:36:38 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2016-05-22 11:36:38 +1000 |
commit | 8982e3f33e4c1d47fe31d71c8dc25e929d7b99d7 (patch) | |
tree | 7cc7e634f469f98c56015dbfc1c356e13b908e46 | |
parent | d8637dfb7e581c9745aa8f7f505b971c99720159 (diff) | |
download | craftbukkit-8982e3f33e4c1d47fe31d71c8dc25e929d7b99d7.tar craftbukkit-8982e3f33e4c1d47fe31d71c8dc25e929d7b99d7.tar.gz craftbukkit-8982e3f33e4c1d47fe31d71c8dc25e929d7b99d7.tar.lz craftbukkit-8982e3f33e4c1d47fe31d71c8dc25e929d7b99d7.tar.xz craftbukkit-8982e3f33e4c1d47fe31d71c8dc25e929d7b99d7.zip |
SPIGOT-2297: Reintroduce getChunkIfLoaded
-rw-r--r-- | nms-patches/ChunkProviderServer.patch | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/nms-patches/ChunkProviderServer.patch b/nms-patches/ChunkProviderServer.patch index f33c3aad..c3349bd1 100644 --- a/nms-patches/ChunkProviderServer.patch +++ b/nms-patches/ChunkProviderServer.patch @@ -18,7 +18,7 @@ public final ChunkGenerator chunkGenerator; private final IChunkLoader chunkLoader; public final Long2ObjectMap<Chunk> chunks = new Long2ObjectOpenHashMap(8192); -@@ -69,19 +75,68 @@ +@@ -69,19 +75,74 @@ Chunk chunk = this.getLoadedChunkAt(i, j); if (chunk == null) { @@ -45,6 +45,12 @@ return chunk; } ++ // CraftBukkit start ++ public Chunk getChunkIfLoaded(int x, int z) { ++ return chunks.get(ChunkCoordIntPair.a(x, z)); ++ } ++ // CraftBukkit end ++ public Chunk getChunkAt(int i, int j) { - Chunk chunk = this.getOrLoadChunkAt(i, j); + return getChunkAt(i, j, null); @@ -55,7 +61,7 @@ + } + + public Chunk getChunkAt(int i, int j, Runnable runnable, boolean generate) { -+ Chunk chunk = chunks.get(ChunkCoordIntPair.a(i, j)); ++ Chunk chunk = getChunkIfLoaded(i, j); + ChunkRegionLoader loader = null; + + if (this.chunkLoader instanceof ChunkRegionLoader) { @@ -89,7 +95,7 @@ if (chunk == null) { long k = ChunkCoordIntPair.a(i, j); -@@ -97,9 +152,37 @@ +@@ -97,9 +158,37 @@ crashreportsystemdetails.a("Generator", (Object) this.chunkGenerator); throw new ReportedException(crashreport); } @@ -116,7 +122,7 @@ + continue; + } + -+ Chunk neighbor = this.getLoadedChunkAt(chunk.locX + x, chunk.locZ + z); ++ Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z); + if (neighbor != null) { + neighbor.setNeighborLoaded(-x, -z); + chunk.setNeighborLoaded(x, z); @@ -127,7 +133,7 @@ chunk.loadNearby(this, this.chunkGenerator); } -@@ -146,10 +229,12 @@ +@@ -146,10 +235,12 @@ public boolean a(boolean flag) { int i = 0; @@ -143,7 +149,7 @@ if (flag) { this.saveChunkNOP(chunk); -@@ -182,6 +267,29 @@ +@@ -182,6 +273,29 @@ Chunk chunk = (Chunk) this.chunks.get(olong); if (chunk != null && chunk.d) { @@ -161,7 +167,7 @@ + continue; + } + -+ Chunk neighbor = this.chunks.get(ChunkCoordIntPair.a(chunk.locX + x, chunk.locZ + z)); ++ Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z); + if (neighbor != null) { + neighbor.setNeighborUnloaded(-x, -z); + chunk.setNeighborUnloaded(x, z); |