diff options
author | Aikar <[email protected]> | 2018-09-27 23:52:46 -0400 |
---|---|---|
committer | Aikar <[email protected]> | 2018-09-27 23:52:46 -0400 |
commit | 22fd6384829be11a3ef24637b7f9d54cb6e36c64 (patch) | |
tree | 10addcb1e3638c7f1390c49a2e353b35607a6781 /Spigot-Server-Patches | |
parent | de977253d91f4ca300ae0bd793977813afed5125 (diff) | |
download | Paper-22fd6384829be11a3ef24637b7f9d54cb6e36c64.tar.gz Paper-22fd6384829be11a3ef24637b7f9d54cb6e36c64.zip |
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 enttiy 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.
Hopefully will fix issues #1496 and #1434
Diffstat (limited to 'Spigot-Server-Patches')
-rw-r--r-- | Spigot-Server-Patches/0362-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0362-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch b/Spigot-Server-Patches/0362-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch new file mode 100644 index 0000000000..fad5adbdf5 --- /dev/null +++ b/Spigot-Server-Patches/0362-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch @@ -0,0 +1,44 @@ +From 2583b7ee5959cd427bf88fdc24c10cbcfa774691 Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +Date: Thu, 27 Sep 2018 23:46:03 -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 enttiy 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/World.java b/src/main/java/net/minecraft/server/World.java +index 64d75934bc..bcbdadbd3a 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -1181,7 +1181,7 @@ public abstract class World implements IBlockAccess { + + int i = MathHelper.floor(entity.locX / 16.0D); + int j = MathHelper.floor(entity.locZ / 16.0D); +- boolean flag = entity.attachedToPlayer; ++ boolean flag = true; // Paper - always load chunks + + // Paper start - Set origin location when the entity is being added to the world + if (entity.origin == null) { +@@ -1826,7 +1826,7 @@ public abstract class World implements IBlockAccess { + this.getChunkAt(entity.ab, entity.ad).a(entity, entity.ac); + } + +- if (!entity.bD() && !this.isChunkLoaded(i, k, true)) { ++ if (!entity.valid && !entity.bD() && !this.isChunkLoaded(i, k, true)) { // Paper - always load to new chunk if valid + entity.aa = false; + } else { + this.getChunkAt(i, k).a(entity); +-- +2.19.0 + |