mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
9dc4d6448b
While it wasn't really "broken" before, if plugins use NMS (which they really should't be) and mess with entity management themselves, and get it wrong, they could ultimately corrupt our state expectations. I've been unable to reproduce any issues locally, but these changes are the result of me analyzing the code pretty deeply and seeing about how to make it more durable to abnormal usage. Any servers seeing oddities, please run with -Ddebug.entities=true and send me any logs triggered.
33 lines
1.5 KiB
Diff
33 lines
1.5 KiB
Diff
From 057008b9c48ae55e921b3ee0014df76b4509118e Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Sat, 28 Jul 2018 12:09:20 -0400
|
|
Subject: [PATCH] Always process chunk removal in removeEntity
|
|
|
|
Spigot might skip chunk registration changes in removeEntity
|
|
which can keep them in the chunk when they shouldnt be if done
|
|
during entity ticking.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
|
index 1929e9d2ae..1cbe6e17b7 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -1107,13 +1107,14 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
|
this.everyoneSleeping();
|
|
}
|
|
|
|
- if (!guardEntityList) { // Spigot - It will get removed after the tick if we are ticking
|
|
+ // if (!guardEntityList) { // Spigot - It will get removed after the tick if we are ticking // Paper - move down
|
|
int i = entity.chunkX;
|
|
int j = entity.chunkZ;
|
|
|
|
Chunk chunk = entity.getCurrentChunk(); // Paper
|
|
if (chunk != null) chunk.removeEntity(entity); // Paper
|
|
|
|
+ if (!guardEntityList) { // Spigot - It will get removed after the tick if we are ticking // Paper - always remove from current chunk above
|
|
// CraftBukkit start - Decrement loop variable field if we've already ticked this entity
|
|
int index = this.entityList.indexOf(entity);
|
|
if (index != -1) {
|
|
--
|
|
2.21.0
|
|
|