From cf817bd29255793ec766e1236bdbd84b5fc44cb9 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 29 Jul 2018 12:10:20 -0400 Subject: [PATCH] Always process chunk registration after moving This will help guarantee that entities are always in the chunk that they are currently located at. Should hopefully also fix Citizens triggering the "Saved to wrong chunk" message --- ...cess-chunk-registration-after-moving.patch | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Spigot-Server-Patches/Always-process-chunk-registration-after-moving.patch diff --git a/Spigot-Server-Patches/Always-process-chunk-registration-after-moving.patch b/Spigot-Server-Patches/Always-process-chunk-registration-after-moving.patch new file mode 100644 index 0000000000..0e18841a53 --- /dev/null +++ b/Spigot-Server-Patches/Always-process-chunk-registration-after-moving.patch @@ -0,0 +1,65 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 29 Jul 2018 11:58:05 -0400 +Subject: [PATCH] Always process chunk registration after moving + +This will help guarantee that entities are always in the +chunk that they are currently located at. + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index 45e149f4a..fce677f9f 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper + this.locX = d0; + this.locY = d1; + this.locZ = d2; ++ if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk + float f = this.width / 2.0F; + float f1 = this.length; + +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper + this.locX = (axisalignedbb.a + axisalignedbb.d) / 2.0D; + this.locY = axisalignedbb.b; + this.locZ = (axisalignedbb.c + axisalignedbb.f) / 2.0D; ++ if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk + } + + protected SoundEffect ae() { +diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java +index 8a9e16ad6..0b1d7a086 100644 +--- a/src/main/java/net/minecraft/server/EntityArrow.java ++++ b/src/main/java/net/minecraft/server/EntityArrow.java +@@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile { + this.inGround = true; + this.shake = 7; + this.setCritical(false); ++ if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk + if (iblockdata.getMaterial() != Material.AIR) { + this.av.a(this.world, blockposition, iblockdata, (Entity) this); + } +diff --git a/src/main/java/net/minecraft/server/EntityLeash.java b/src/main/java/net/minecraft/server/EntityLeash.java +index 7bd1c73bf..10a507595 100644 +--- a/src/main/java/net/minecraft/server/EntityLeash.java ++++ b/src/main/java/net/minecraft/server/EntityLeash.java +@@ -0,0 +0,0 @@ public class EntityLeash extends EntityHanging { + this.locX = (double) this.blockPosition.getX() + 0.5D; + this.locY = (double) this.blockPosition.getY() + 0.5D; + this.locZ = (double) this.blockPosition.getZ() + 0.5D; ++ if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk + } + + public void setDirection(EnumDirection enumdirection) {} +diff --git a/src/main/java/net/minecraft/server/EntityShulker.java b/src/main/java/net/minecraft/server/EntityShulker.java +index 3ce843199..ad7c95924 100644 +--- a/src/main/java/net/minecraft/server/EntityShulker.java ++++ b/src/main/java/net/minecraft/server/EntityShulker.java +@@ -0,0 +0,0 @@ public class EntityShulker extends EntityGolem implements IMonster { + this.locX = (double) blockposition.getX() + 0.5D; + this.locY = (double) blockposition.getY(); + this.locZ = (double) blockposition.getZ() + 0.5D; ++ if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk + this.lastX = this.locX; + this.lastY = this.locY; + this.lastZ = this.locZ; +-- \ No newline at end of file