Paper/nms-patches/RegionFile.patch

49 lines
1.3 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/RegionFile.java
+++ b/net/minecraft/server/RegionFile.java
2016-11-17 02:41:03 +01:00
@@ -86,6 +86,45 @@
2015-02-26 23:41:06 +01:00
}
+ // 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;
+ }
+ }
2015-02-26 23:41:06 +01:00
+
+ return false;
2015-02-26 23:41:06 +01:00
+ }
+ // CraftBukkit end
2015-02-26 23:41:06 +01:00
+
2016-11-17 02:41:03 +01:00
@Nullable
public synchronized DataInputStream a(int i, int j) {
if (this.d(i, j)) {