mirror of
https://github.com/PaperMC/Paper.git
synced 2024-08-21 20:02:55 +02:00
Use the distance map to find candidate players for tracking. This also ports a few utility changes from Tuinity
36 lines
1.5 KiB
Diff
36 lines
1.5 KiB
Diff
From 80f240c7853f1795c5e7959e3daec3e1af7faee3 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Tue, 31 Mar 2020 03:01:45 -0400
|
|
Subject: [PATCH] Fix unregistering entities from unloading chunks
|
|
|
|
CraftBukkit caused a regression here by making unloading chunks not
|
|
have a ticket added and returning unloaded future.
|
|
|
|
This caused entities who were killed in same tick their chunk is unloading
|
|
to not be able to be removed from the chunk.
|
|
|
|
This then results in dead entities lingering in the Chunk.
|
|
|
|
Combine that with a buggy detail of the previous implementation of
|
|
the Dupe UUID patch, then this was the likely source of the "Ghost entities"
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
|
index 3fc25183ca..9fbe8fa1b2 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -1506,9 +1506,9 @@ public class WorldServer extends World {
|
|
}
|
|
|
|
private void removeEntityFromChunk(Entity entity) {
|
|
- IChunkAccess ichunkaccess = this.getChunkAt(entity.chunkX, entity.chunkZ, ChunkStatus.FULL, false);
|
|
+ Chunk ichunkaccess = entity.getCurrentChunk(); // Paper - getChunkAt(x,z,full,false) is broken by CraftBukkit as it won't return an unloading chunk. Use our current chunk reference as this points to what chunk they need to be removed from anyways
|
|
|
|
- if (ichunkaccess instanceof Chunk) {
|
|
+ if (ichunkaccess != null) { // Paper
|
|
((Chunk) ichunkaccess).b(entity);
|
|
}
|
|
|
|
--
|
|
2.26.0
|
|
|