mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 04:31:58 +01:00
48b1b0aac5
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.
66 lines
2.5 KiB
Diff
66 lines
2.5 KiB
Diff
From 352ece97092f16a3e286a80a585c9da808c174dc Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Sat, 29 Sep 2018 01:18:16 -0400
|
|
Subject: [PATCH] Fix Sending Chunks to Client
|
|
|
|
Vanilla has some screwy logic that doesn't send a chunk until
|
|
it has been post processed. This is an issue as post processing
|
|
doesn't occur until all neighbor chunks have been loaded.
|
|
|
|
This can reduce view distance while generating terrain, but also
|
|
cause bugs where chunks are never sent to the client.
|
|
|
|
This fix always sends chunks to the client, and simply updates
|
|
the client anytime post processing is triggered with the new chunk data.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
|
index 895eb60854..350479dc68 100644
|
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
|
@@ -1212,7 +1212,7 @@ public class Chunk implements IChunkAccess {
|
|
}
|
|
|
|
public boolean isReady() {
|
|
- return this.C.a(ChunkStatus.POSTPROCESSED);
|
|
+ return true; // Paper - Always send chunks
|
|
}
|
|
|
|
public boolean v() {
|
|
@@ -1478,6 +1478,13 @@ public class Chunk implements IChunkAccess {
|
|
com.google.common.base.Preconditions.checkState(this.h.isEmpty(), "Pending tiles not empty"); // CraftBukkit
|
|
this.a(ChunkStatus.POSTPROCESSED);
|
|
this.m.a(this);
|
|
+ // Paper start - resend chunk after post process
|
|
+ PlayerChunk playerChunk = ((WorldServer) world).getPlayerChunkMap().getChunk(locX, locZ);
|
|
+ if (playerChunk != null) {
|
|
+ playerChunk.done = false;
|
|
+ playerChunk.sendAll();
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
|
|
index 242691d89d..86f0fb3c2a 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
|
|
@@ -23,7 +23,7 @@ public class PlayerChunk {
|
|
private int dirtyCount;
|
|
private int h;
|
|
private long i;
|
|
- private boolean done;
|
|
+ boolean done; // Paper - package-private
|
|
|
|
// CraftBukkit start - add fields
|
|
// You know the drill, https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse
|
|
@@ -146,6 +146,7 @@ public class PlayerChunk {
|
|
}
|
|
}
|
|
|
|
+ public boolean sendAll() { return b(); } // Paper - OBFHELPER
|
|
public boolean b() {
|
|
if (this.done) {
|
|
return true;
|
|
--
|
|
2.19.0
|
|
|