Paper/Spigot-Server-Patches/0373-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch
Shane Freeder f8fd607e04
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
bbfd13dd Hyperlink 'Events' in raid event package documentation
b2095bed SPIGOT-5413: Add TrustedPlayer API for foxes
1bf1f3f4 Block trace methods do not require hash sets
abf0cfdc Javadoc improvements per checkstyle
c4a2b425 Add TimeSkipEvent

CraftBukkit Changes:
817116de SPIGOT-5413: Add TrustedPlayer API for foxes
062680a8 SPIGOT-5467: Calm down bees that cannot exit hive
75fac431 SPIGOT-5472: Spurious warning when using clone command on tile entities
85106731 SPIGOT-5471: Allow empty title/author for books
2d9db47f Add TimeSkipEvent
384225c2 Add thread name to TerminalConsoleWriterThread

Spigot Changes:
05bb8bcf Postpone stopping the watchdog until the server is completely stopped
18e2b9be Add package-info.java for Spigot APIs
2019-12-23 02:37:47 +00:00

46 lines
2.1 KiB
Diff

From da5add0dd519ed45bb4ec1633e522986c1c4050c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 28 Sep 2018 21:49:53 -0400
Subject: [PATCH] Fix issues with entity loss due to unloaded chunks
Vanilla has risk of losing entities by causing them to be
removed from all chunks if they try to move into an unloaded chunk.
This pretty much means high chance this entity will be lost in this
scenario.
There is another case that adding an entity to the world can fail if
the chunk isn't loaded.
Lots of the server is designed around addEntity never expecting to fail
for these reasons, nor is it really logical.
This change ensures the chunks are always loaded when entities are
added to the world, or a valid entity moves between chunks.
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 8428ce779..ae1e4b34b 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -693,7 +693,7 @@ public class WorldServer extends World {
this.getChunkAt(entity.chunkX, entity.chunkZ).a(entity, entity.chunkY);
}
- if (!entity.cc() && !this.isChunkLoaded(i, k)) {
+ if (!entity.valid && !entity.cc() && !this.isChunkLoaded(i, k)) { // Paper - always load chunks to register valid entities location
entity.inChunk = false;
} else {
this.getChunkAt(i, k).a(entity);
@@ -1018,7 +1018,7 @@ public class WorldServer extends World {
return false;
}
// CraftBukkit end
- IChunkAccess ichunkaccess = this.getChunkAt(MathHelper.floor(entity.locX() / 16.0D), MathHelper.floor(entity.locZ() / 16.0D), ChunkStatus.FULL, entity.attachedToPlayer);
+ IChunkAccess ichunkaccess = this.getChunkAt(MathHelper.floor(entity.locX() / 16.0D), MathHelper.floor(entity.locZ() / 16.0D), ChunkStatus.FULL, true); // Paper - always load chunks for entity adds
if (!(ichunkaccess instanceof Chunk)) {
return false;
--
2.24.1