Optimize Spare Chunk loads to be removed faster
this has technically been a longer standing problem, but if an async chunk loads after a chunk has been removed from the chunk map, it would be treated as any other spare chunk and kept loaded until Chunk GC kicks in. This fixes that, but also obsoletes ChunkGC in that anytime we load a spare chunk (a chunk outside of any players view distance), we will immediately mark it for unload. This should reduce the amount of spare chunks loaded on a server.
This commit is contained in:
@@ -1215,7 +1215,7 @@ index 0000000000..47d9ecdbf1
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
index e7d465fb8a..61de438fdf 100644
|
||||
index 2a889dc20a..242691d89d 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunk {
|
||||
@@ -1265,8 +1265,8 @@ index e7d465fb8a..61de438fdf 100644
|
||||
+ }
|
||||
+ // Paper end
|
||||
// Paper start - delay chunk unloads
|
||||
public final void markChunkUsed() {
|
||||
if (chunk != null && chunk.scheduledForUnload != null) {
|
||||
private void markChunkUsed() {
|
||||
if (chunk == null) {
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunk {
|
||||
ChunkProviderServer chunkproviderserver = playerchunkmap.getWorld().getChunkProviderServer();
|
||||
|
||||
@@ -1279,8 +1279,8 @@ index e7d465fb8a..61de438fdf 100644
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunk {
|
||||
if (this.c.isEmpty()) {
|
||||
this.i = this.playerChunkMap.getWorld().getTime();
|
||||
chunkHasPlayers = false; // Paper - delay chunk unloads
|
||||
markChunkUsed(); // Paper - delay chunk unloads
|
||||
}
|
||||
+ checkHighPriority(entityplayer); // Paper
|
||||
|
||||
|
||||
Reference in New Issue
Block a user