2016-06-12 11:28:27 +02:00
|
|
|
--- a/net/minecraft/server/RegionFileCache.java
|
|
|
|
+++ b/net/minecraft/server/RegionFileCache.java
|
2019-04-23 04:00:00 +02:00
|
|
|
@@ -18,7 +18,7 @@
|
2019-12-10 23:00:00 +01:00
|
|
|
this.b = file;
|
2018-08-26 04:00:00 +02:00
|
|
|
}
|
|
|
|
|
2019-12-10 23:00:00 +01:00
|
|
|
- private RegionFile getFile(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
|
|
|
+ private RegionFile getFile(ChunkCoordIntPair chunkcoordintpair, boolean existingOnly) throws IOException { // CraftBukkit
|
2019-04-23 04:00:00 +02:00
|
|
|
long i = ChunkCoordIntPair.pair(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ());
|
|
|
|
RegionFile regionfile = (RegionFile) this.cache.getAndMoveToFirst(i);
|
2018-08-26 04:00:00 +02:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
@@ -34,6 +34,7 @@
|
|
|
|
}
|
|
|
|
|
2019-12-10 23:00:00 +01:00
|
|
|
File file = new File(this.b, "r." + chunkcoordintpair.getRegionX() + "." + chunkcoordintpair.getRegionZ() + ".mca");
|
2019-04-23 04:00:00 +02:00
|
|
|
+ if (existingOnly && !file.exists()) return null; // CraftBukkit
|
2019-12-10 23:00:00 +01:00
|
|
|
RegionFile regionfile1 = new RegionFile(file, this.b);
|
2019-04-23 04:00:00 +02:00
|
|
|
|
|
|
|
this.cache.putAndMoveToFirst(i, regionfile1);
|
|
|
|
@@ -43,7 +44,7 @@
|
2016-06-12 11:28:27 +02:00
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
@Nullable
|
2019-04-23 04:00:00 +02:00
|
|
|
public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
2019-12-10 23:00:00 +01:00
|
|
|
- RegionFile regionfile = this.getFile(chunkcoordintpair);
|
|
|
|
+ RegionFile regionfile = this.getFile(chunkcoordintpair, false); // CraftBukkit
|
2019-04-23 04:00:00 +02:00
|
|
|
DataInputStream datainputstream = regionfile.a(chunkcoordintpair);
|
|
|
|
Throwable throwable = null;
|
2016-06-12 11:28:27 +02:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
@@ -78,7 +79,7 @@
|
2016-06-12 11:28:27 +02:00
|
|
|
}
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
protected void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException {
|
2019-12-10 23:00:00 +01:00
|
|
|
- RegionFile regionfile = this.getFile(chunkcoordintpair);
|
|
|
|
+ RegionFile regionfile = this.getFile(chunkcoordintpair, false); // CraftBukkit
|
2019-04-23 04:00:00 +02:00
|
|
|
DataOutputStream dataoutputstream = regionfile.c(chunkcoordintpair);
|
|
|
|
Throwable throwable = null;
|
2016-06-12 11:28:27 +02:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
@@ -114,4 +115,12 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2018-08-26 04:00:00 +02:00
|
|
|
+
|
2019-04-23 04:00:00 +02:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ public boolean chunkExists(ChunkCoordIntPair pos) throws IOException {
|
2019-12-10 23:00:00 +01:00
|
|
|
+ RegionFile regionfile = getFile(pos, true);
|
2018-08-26 04:00:00 +02:00
|
|
|
+
|
2019-12-10 23:00:00 +01:00
|
|
|
+ return regionfile != null ? regionfile.chunkExists(pos) : false;
|
2019-04-23 04:00:00 +02:00
|
|
|
+ }
|
2016-06-12 11:28:27 +02:00
|
|
|
+ // CraftBukkit end
|
2018-08-26 04:00:00 +02:00
|
|
|
}
|