summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authorGeoff Crossland <gcrossland+bukkit@gmail.com>2017-01-31 23:52:21 +0000
committermd_5 <git@md-5.net>2017-04-27 21:25:33 +1000
commit6194f6cc4985a4a6840bb2cc39375caf9835ae68 (patch)
tree8b7fbbd61df2878e006b0766393f1329d4d00608 /nms-patches
parent55a1f9ff12e69ef036ae999dc8cf63f2622cc873 (diff)
downloadcraftbukkit-6194f6cc4985a4a6840bb2cc39375caf9835ae68.tar
craftbukkit-6194f6cc4985a4a6840bb2cc39375caf9835ae68.tar.gz
craftbukkit-6194f6cc4985a4a6840bb2cc39375caf9835ae68.tar.lz
craftbukkit-6194f6cc4985a4a6840bb2cc39375caf9835ae68.tar.xz
craftbukkit-6194f6cc4985a4a6840bb2cc39375caf9835ae68.zip
Drop RegionFile.chunkExists() in favour of Mojang's own version
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/ChunkProviderServer.patch4
-rw-r--r--nms-patches/ChunkRegionLoader.patch41
-rw-r--r--nms-patches/RegionFile.patch54
-rw-r--r--nms-patches/RegionFileCache.patch7
4 files changed, 35 insertions, 71 deletions
diff --git a/nms-patches/ChunkProviderServer.patch b/nms-patches/ChunkProviderServer.patch
index bcb4586a..954d9073 100644
--- a/nms-patches/ChunkProviderServer.patch
+++ b/nms-patches/ChunkProviderServer.patch
@@ -22,7 +22,7 @@
+ if (this.chunkLoader instanceof ChunkRegionLoader) {
+ loader = (ChunkRegionLoader) this.chunkLoader;
+ }
-+ if (loader != null && loader.chunkExists(world, i, j)) {
++ if (loader != null && loader.a(i, j)) {
+ chunk = ChunkIOExecutor.syncChunkLoad(world, loader, this, i, j);
+ }
+ }
@@ -72,7 +72,7 @@
+
+ }
+ // We can only use the queue for already generated chunks
-+ if (chunk == null && loader != null && loader.chunkExists(world, i, j)) {
++ if (chunk == null && loader != null && loader.a(i, j)) {
+ if (runnable != null) {
+ ChunkIOExecutor.queueChunkLoad(world, loader, this, i, j, runnable);
+ return null;
diff --git a/nms-patches/ChunkRegionLoader.patch b/nms-patches/ChunkRegionLoader.patch
index fb39a6e0..f83005d8 100644
--- a/nms-patches/ChunkRegionLoader.patch
+++ b/nms-patches/ChunkRegionLoader.patch
@@ -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 @@
}
}
diff --git a/nms-patches/RegionFile.patch b/nms-patches/RegionFile.patch
index de585900..a1abb025 100644
--- a/nms-patches/RegionFile.patch
+++ b/nms-patches/RegionFile.patch
@@ -1,48 +1,16 @@
--- a/net/minecraft/server/RegionFile.java
+++ b/net/minecraft/server/RegionFile.java
-@@ -86,6 +86,45 @@
+@@ -224,11 +224,11 @@
+ return i < 0 || i >= 32 || j < 0 || j >= 32;
+ }
+
+- private int e(int i, int j) {
++ private synchronized int e(int i, int j) { // CraftBukkit
+ return this.d[i + j * 32];
+ }
+- public boolean c(int i, int j) {
++ public boolean c(int i, int j) { // PAIL chunkExists
+ return this.e(i, j) != 0;
}
-+ // CraftBukkit start - This is a copy (sort of) of the method below it, make sure they stay in sync
-+ public synchronized boolean chunkExists(int i, int j) {
-+ if (this.d(i, j)) {
-+ return false;
-+ } else {
-+ try {
-+ int k = this.e(i, j);
-+
-+ if (k == 0) {
-+ return false;
-+ } else {
-+ int l = k >> 8;
-+ int i1 = k & 255;
-+
-+ if (l + i1 > this.f.size()) {
-+ return false;
-+ }
-+
-+ this.c.seek((long) (l * 4096));
-+ int j1 = this.c.readInt();
-+
-+ if (j1 > 4096 * i1 || j1 <= 0) {
-+ return false;
-+ }
-+
-+ byte b0 = this.c.readByte();
-+ if (b0 == 1 || b0 == 2) {
-+ return true;
-+ }
-+ }
-+ } catch (IOException ioexception) {
-+ return false;
-+ }
-+ }
-+
-+ return false;
-+ }
-+ // CraftBukkit end
-+
- @Nullable
- public synchronized DataInputStream a(int i, int j) {
- if (this.d(i, j)) {
diff --git a/nms-patches/RegionFileCache.patch b/nms-patches/RegionFileCache.patch
index e97b881c..fe90d577 100644
--- a/nms-patches/RegionFileCache.patch
+++ b/nms-patches/RegionFileCache.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/RegionFileCache.java
+++ b/net/minecraft/server/RegionFileCache.java
-@@ -74,17 +74,27 @@
+@@ -74,19 +74,29 @@
RegionFileCache.a.clear();
}
@@ -30,5 +30,8 @@
}
+ // CraftBukkit end
- public static boolean f(File file, int i, int j) {
+- public static boolean f(File file, int i, int j) {
++ public static synchronized boolean f(File file, int i, int j) { // PAIL chunkExists; CraftBukkit
RegionFile regionfile = b(file, i, j);
+
+ return regionfile != null ? regionfile.c(i & 31, j & 31) : false;