SPIGOT-1659: Fix a mistake in ChunkProviderServer that sometimes caused recursive chunk loads

This commit is contained in:
Thinkofdeath 2016-03-02 21:27:49 +00:00
parent 6f032cdc8a
commit 8447e4f3ed

View file

@ -98,7 +98,7 @@
return chunk; return chunk;
} }
@@ -61,20 +86,66 @@ @@ -61,20 +86,67 @@
Chunk chunk = this.getLoadedChunkAt(i, j); Chunk chunk = this.getLoadedChunkAt(i, j);
if (chunk == null) { if (chunk == null) {
@ -127,6 +127,7 @@
} }
public Chunk getChunkAt(int i, int j) { public Chunk getChunkAt(int i, int j) {
- Chunk chunk = this.getOrLoadChunkAt(i, j);
+ return getChunkAt(i, j, null); + return getChunkAt(i, j, null);
+ } + }
+ +
@ -160,13 +161,14 @@
+ } + }
+ +
+ public Chunk originalGetChunkAt(int i, int j) { + public Chunk originalGetChunkAt(int i, int j) {
Chunk chunk = this.getOrLoadChunkAt(i, j); + this.unloadQueue.remove(i, j);
+ Chunk chunk = this.chunks.get(LongHash.toLong(i, j));
+ boolean newChunk = false; + boolean newChunk = false;
+ // CraftBukkit end + // CraftBukkit end
if (chunk == null) { if (chunk == null) {
long k = ChunkCoordIntPair.a(i, j); long k = ChunkCoordIntPair.a(i, j);
@@ -92,11 +163,38 @@ @@ -92,11 +164,38 @@
crashreportsystemdetails.a("Generator", (Object) this.chunkGenerator); crashreportsystemdetails.a("Generator", (Object) this.chunkGenerator);
throw new ReportedException(crashreport); throw new ReportedException(crashreport);
} }
@ -207,7 +209,7 @@
chunk.loadNearby(this, this.chunkGenerator); chunk.loadNearby(this, this.chunkGenerator);
} }
@@ -142,10 +240,12 @@ @@ -142,10 +241,12 @@
public boolean a(boolean flag) { public boolean a(boolean flag) {
int i = 0; int i = 0;
@ -223,7 +225,7 @@
if (flag) { if (flag) {
this.saveChunkNOP(chunk); this.saveChunkNOP(chunk);
@@ -170,22 +270,43 @@ @@ -170,22 +271,43 @@
public boolean unloadChunks() { public boolean unloadChunks() {
if (!this.world.savingDisabled) { if (!this.world.savingDisabled) {
@ -274,7 +276,7 @@
this.chunkLoader.a(); this.chunkLoader.a();
} }
@@ -198,7 +319,8 @@ @@ -198,7 +320,8 @@
} }
public String getName() { public String getName() {
@ -284,7 +286,7 @@
} }
public List<BiomeBase.BiomeMeta> a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) { public List<BiomeBase.BiomeMeta> a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
@@ -210,10 +332,11 @@ @@ -210,10 +333,11 @@
} }
public int g() { public int g() {