Drop RegionFile.chunkExists() in favour of Mojang's own version
By: Geoff Crossland <gcrossland+bukkit@gmail.com>
This commit is contained in:
@@ -1,23 +1,9 @@
|
||||
--- a/net/minecraft/server/ChunkRegionLoader.java
|
||||
+++ b/net/minecraft/server/ChunkRegionLoader.java
|
||||
@@ -29,19 +29,49 @@
|
||||
@@ -29,25 +29,41 @@
|
||||
this.e = dataconvertermanager;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public boolean chunkExists(World world, int i, int j) {
|
||||
+ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
|
||||
+
|
||||
+ if (this.c.contains(chunkcoordintpair)) {
|
||||
+ if (this.b.containsKey(chunkcoordintpair)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return RegionFileCache.a(this.d, i, j).chunkExists(i & 31, j & 31);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ // CraftBukkit start - Add async variant, provide compatibility
|
||||
@Nullable
|
||||
public Chunk a(World world, int i, int j) throws IOException {
|
||||
@@ -53,7 +39,14 @@
|
||||
}
|
||||
|
||||
return this.a(world, i, j, nbttagcompound);
|
||||
@@ -55,7 +85,7 @@
|
||||
}
|
||||
|
||||
- public boolean a(int i, int j) {
|
||||
+ public boolean a(int i, int j) { // PAIL chunkExists (also in IChunkLoader)
|
||||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) this.b.get(chunkcoordintpair);
|
||||
|
||||
@@ -55,7 +71,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -62,7 +55,7 @@
|
||||
if (!nbttagcompound.hasKeyOfType("Level", 10)) {
|
||||
ChunkRegionLoader.a.error("Chunk file at {},{} is missing level data, skipping", new Object[] { Integer.valueOf(i), Integer.valueOf(j)});
|
||||
return null;
|
||||
@@ -72,10 +102,28 @@
|
||||
@@ -72,10 +88,28 @@
|
||||
ChunkRegionLoader.a.error("Chunk file at {},{} is in the wrong location; relocating. (Expected {}, {}, got {}, {})", new Object[] { Integer.valueOf(i), Integer.valueOf(j), Integer.valueOf(i), Integer.valueOf(j), Integer.valueOf(chunk.locX), Integer.valueOf(chunk.locZ)});
|
||||
nbttagcompound1.setInt("xPos", i);
|
||||
nbttagcompound1.setInt("zPos", j);
|
||||
@@ -92,7 +85,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,20 +154,27 @@
|
||||
@@ -106,20 +140,27 @@
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
@@ -123,7 +116,7 @@
|
||||
|
||||
if (nbttagcompound != null) {
|
||||
try {
|
||||
@@ -139,10 +194,14 @@
|
||||
@@ -139,10 +180,14 @@
|
||||
}
|
||||
|
||||
private void b(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException {
|
||||
@@ -139,7 +132,7 @@
|
||||
}
|
||||
|
||||
public void b(World world, Chunk chunk) throws IOException {}
|
||||
@@ -157,6 +216,7 @@
|
||||
@@ -157,6 +202,7 @@
|
||||
if (this.c()) {
|
||||
continue;
|
||||
}
|
||||
@@ -147,7 +140,7 @@
|
||||
}
|
||||
} finally {
|
||||
this.f = false;
|
||||
@@ -334,6 +394,13 @@
|
||||
@@ -334,6 +380,13 @@
|
||||
chunk.a(nbttagcompound.getByteArray("Biomes"));
|
||||
}
|
||||
|
||||
@@ -161,7 +154,7 @@
|
||||
NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10);
|
||||
|
||||
for (int l = 0; l < nbttaglist1.size(); ++l) {
|
||||
@@ -371,7 +438,7 @@
|
||||
@@ -371,7 +424,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +163,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -399,14 +466,20 @@
|
||||
@@ -399,14 +452,20 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -192,7 +185,7 @@
|
||||
return null;
|
||||
} else {
|
||||
if (nbttagcompound.hasKeyOfType("Passengers", 9)) {
|
||||
@@ -435,8 +508,14 @@
|
||||
@@ -435,8 +494,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user