Always send untrack chunk packets

Vanilla inserted the alive check so that dead players
could see the chunks around them, but in Folia we do not
remove dead players so chunks will still load for them.

This prevents the client from having chunks in memory it
should not.
This commit is contained in:
Spottedleaf 2023-04-03 22:48:59 -07:00
parent 774141dfb1
commit d34fb878bb
1 changed files with 10 additions and 1 deletions

View File

@ -15976,7 +15976,7 @@ index bf1a77cf9bbea4e2104b2a8c61309e740f28d51b..acc8af33ad8534d812908b0feb9a1963
for (ServerPlayer player : ServerLevel.this.players) {
player.getBukkitEntity().onEntityRemove(entity);
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 4231c3fe14a621d237bdc3d56c593f0adc0a7bc6..7935fccf078ba92b3bafde7eb3cd146f57af37c2 100644
index 4231c3fe14a621d237bdc3d56c593f0adc0a7bc6..5f53c9ad5d64053a2e29c58ddb62e7d2bd176efe 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -188,7 +188,7 @@ import org.bukkit.inventory.MainHand;
@ -16490,6 +16490,15 @@ index 4231c3fe14a621d237bdc3d56c593f0adc0a7bc6..7935fccf078ba92b3bafde7eb3cd146f
this.camera = (Entity) (entity == null ? this : entity);
if (entity1 != this.camera) {
// Paper start - Add PlayerStartSpectatingEntityEvent and PlayerStopSpectatingEntity Event
@@ -2291,7 +2678,7 @@ public class ServerPlayer extends Player {
}
public void untrackChunk(ChunkPos chunkPos) {
- if (this.isAlive()) {
+ if (true || this.isAlive()) { // Folia - region threading - always untrack chunk now that the player is retained in the world after death
this.connection.send(new ClientboundForgetLevelChunkPacket(chunkPos.x, chunkPos.z));
// Paper start
if(io.papermc.paper.event.packet.PlayerChunkUnloadEvent.getHandlerList().getRegisteredListeners().length > 0){
@@ -2570,7 +2957,7 @@ public class ServerPlayer extends Player {
this.experienceLevel = this.newLevel;
this.totalExperience = this.newTotalExp;