9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-26 18:39:08 +00:00

Update Paper

This commit is contained in:
violetc
2024-01-27 12:44:45 +08:00
parent 7a6fd95894
commit 20ccc9c0ff
28 changed files with 228 additions and 270 deletions

View File

@@ -21,25 +21,13 @@ index ca79034c1f044a9096de65b0936971c4fd68eb32..990dc1fdd1bffa6bc96f7b325d3e12d5
implementation("org.ow2.asm:asm-commons:9.5")
implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
diff --git a/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java b/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java
index f2c27e0ac65be4b75c1d86ef6fd45fdb538d96ac..036da95df5280e547e60d3b4641dad63ec15c224 100644
--- a/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java
+++ b/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java
@@ -314,8 +314,8 @@ public final class PaperFileIOThread extends QueueExecutorThread {
public abstract void writeData(final int x, final int z, final CompoundTag compound) throws IOException;
public abstract CompoundTag readData(final int x, final int z) throws IOException;
- public abstract <T> T computeForRegionFile(final int chunkX, final int chunkZ, final Function<RegionFile, T> function);
- public abstract <T> T computeForRegionFileIfLoaded(final int chunkX, final int chunkZ, final Function<RegionFile, T> function);
+ public abstract <T> T computeForRegionFile(final int chunkX, final int chunkZ, final Function<top.leavesmc.leaves.region.AbstractRegionFile, T> function); // Leaves
+ public abstract <T> T computeForRegionFileIfLoaded(final int chunkX, final int chunkZ, final Function<top.leavesmc.leaves.region.AbstractRegionFile, T> function); // Leaves
public static final class InProgressWrite {
public long writeCounter;
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java b/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java
index 8a11e10b01fa012b2f98b1c193c53251e848f909..17057486c031708d3aab82a01031cfef426076da 100644
index 2934f0cf0ef09c84739312b00186c2ef0019a165..ad909f888c8eb6fa8d4ebeeebdc538aee749346d 100644
--- a/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java
+++ b/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java
@@ -811,7 +811,7 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
@@ -816,7 +816,7 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
final ChunkDataController taskController) {
final ChunkPos chunkPos = new ChunkPos(chunkX, chunkZ);
if (intendingToBlock) {
@@ -48,7 +36,7 @@ index 8a11e10b01fa012b2f98b1c193c53251e848f909..17057486c031708d3aab82a01031cfef
if (file == null) { // null if no regionfile exists
return Boolean.FALSE;
}
@@ -824,7 +824,7 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
@@ -829,7 +829,7 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
return Boolean.FALSE;
} // else: it either exists or is not known, fall back to checking the loaded region file
@@ -57,7 +45,7 @@ index 8a11e10b01fa012b2f98b1c193c53251e848f909..17057486c031708d3aab82a01031cfef
if (file == null) { // null if not loaded
// not sure at this point, let the I/O thread figure it out
return Boolean.TRUE;
@@ -1126,9 +1126,9 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
@@ -1131,9 +1131,9 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
return this.getCache().doesRegionFileNotExistNoIO(new ChunkPos(chunkX, chunkZ));
}
@@ -69,7 +57,7 @@ index 8a11e10b01fa012b2f98b1c193c53251e848f909..17057486c031708d3aab82a01031cfef
synchronized (cache) {
try {
regionFile = cache.getRegionFile(new ChunkPos(chunkX, chunkZ), existingOnly, true);
@@ -1141,19 +1141,19 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
@@ -1146,19 +1146,19 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
return function.apply(regionFile);
} finally {
if (regionFile != null) {
@@ -93,7 +81,7 @@ index 8a11e10b01fa012b2f98b1c193c53251e848f909..17057486c031708d3aab82a01031cfef
}
}
@@ -1161,7 +1161,7 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
@@ -1166,7 +1166,7 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
return function.apply(regionFile);
} finally {
if (regionFile != null) {
@@ -103,10 +91,10 @@ index 8a11e10b01fa012b2f98b1c193c53251e848f909..17057486c031708d3aab82a01031cfef
}
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 89be9c19db11c9fda0bc21a7f3d30493913e4d3c..e718e1a439dc3e5aef6edd005ba077a09b491260 100644
index 3d682670ae0ae6da7492633d2688dc31086e3665..246dc8c02e096c385931edc4ff0765d61ced7877 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -860,13 +860,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -854,13 +854,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public ChunkStatus getChunkStatusOnDiskIfCached(ChunkPos chunkPos) {
@@ -122,7 +110,7 @@ index 89be9c19db11c9fda0bc21a7f3d30493913e4d3c..e718e1a439dc3e5aef6edd005ba077a0
if (regionFile == null || !regionFileCache.chunkExists(chunkPos)) {
return null;
@@ -884,7 +884,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -878,7 +878,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public void updateChunkStatusOnDisk(ChunkPos chunkPos, @Nullable CompoundTag compound) throws IOException {
@@ -227,7 +215,7 @@ index 6cf83502a954cce9c562ec036bfeddb477d38b73..d43c41d377dd04d0babb99170203e2f5
try (DataInputStream out = new DataInputStream(new java.io.BufferedInputStream(new InflaterInputStream(Files.newInputStream(file))))) {
return NbtIo.read((java.io.DataInput) out);
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index 30d4efc896fe8b2ec0e8b091045c7d07f952b00b..8718b525a84f717a6c2ee9cc6cef8dfd826df8b9 100644
index fe312b1aef579cb4bf81bdd967cf72ff880d7505..8a313a13371109d388b30f40beff6a0d1c798570 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -21,9 +21,14 @@ public class RegionFileStorage implements AutoCloseable {
@@ -326,7 +314,7 @@ index 30d4efc896fe8b2ec0e8b091045c7d07f952b00b..8718b525a84f717a6c2ee9cc6cef8dfd
@@ -123,28 +153,46 @@ public class RegionFileStorage implements AutoCloseable {
}
// Paper end - cache regionfile does not exist state
if (this.regionCache.size() >= io.papermc.paper.configuration.GlobalConfiguration.get().misc.regionFileCacheSize) { // Paper - Sanitise RegionFileCache and make configurable.
if (this.regionCache.size() >= io.papermc.paper.configuration.GlobalConfiguration.get().misc.regionFileCacheSize) { // Paper - Sanitise RegionFileCache and make configurable
- ((RegionFile) this.regionCache.removeLast()).close();
+ this.regionCache.removeLast().close(); // Leaves
}
@@ -445,25 +433,25 @@ index 30d4efc896fe8b2ec0e8b091045c7d07f952b00b..8718b525a84f717a6c2ee9cc6cef8dfd
if (regionfile == null) {
return;
}
@@ -297,7 +345,7 @@ public class RegionFileStorage implements AutoCloseable {
}
@@ -298,7 +346,7 @@ public class RegionFileStorage implements AutoCloseable {
protected void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException {
- RegionFile regionfile = this.getRegionFile(pos, nbt == null, true); // CraftBukkit // Paper // Paper start - rewrite chunk system
// Paper start - rewrite chunk system
- RegionFile regionfile = this.getRegionFile(pos, nbt == null, true); // CraftBukkit
+ top.leavesmc.leaves.region.AbstractRegionFile regionfile = this.getRegionFile(pos, nbt == null, true); // CraftBukkit // Paper // Paper start - rewrite chunk system // Leaves
if (nbt == null && regionfile == null) {
return;
}
@@ -347,7 +395,7 @@ public class RegionFileStorage implements AutoCloseable {
}
@@ -353,7 +401,7 @@ public class RegionFileStorage implements AutoCloseable {
// Paper end - Chunk save reattempt
} finally { // Paper start
// Paper start - rewrite chunk system
} finally {
- regionfile.fileLock.unlock();
+ regionfile.getFileLock().unlock(); // Leaves
} // Paper end
}
// Paper end - rewrite chunk system
}
@@ -356,7 +404,7 @@ public class RegionFileStorage implements AutoCloseable {
@@ -363,7 +411,7 @@ public class RegionFileStorage implements AutoCloseable {
ObjectIterator objectiterator = this.regionCache.values().iterator();
while (objectiterator.hasNext()) {
@@ -472,7 +460,7 @@ index 30d4efc896fe8b2ec0e8b091045c7d07f952b00b..8718b525a84f717a6c2ee9cc6cef8dfd
try {
regionfile.close();
@@ -372,7 +420,7 @@ public class RegionFileStorage implements AutoCloseable {
@@ -379,7 +427,7 @@ public class RegionFileStorage implements AutoCloseable {
ObjectIterator objectiterator = this.regionCache.values().iterator();
while (objectiterator.hasNext()) {
@@ -482,10 +470,10 @@ index 30d4efc896fe8b2ec0e8b091045c7d07f952b00b..8718b525a84f717a6c2ee9cc6cef8dfd
regionfile.flush();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index aa0a1cbbbd4f2f027e24a4166bd5be4009c2ac3e..eedc10b3fd0ae2da321d66d1b08f55edf031accf 100644
index 948a4595d2c3fe91295bef0001d99521403f7a26..ea375449c93d802c63ea697cefb0a39cba79d001 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -565,7 +565,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -567,7 +567,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
world.getChunk(x, z); // make sure we're at ticket level 32 or lower
return true;
}