From 0645364ee5ae64571844eb828eed0da069355fff Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 16 Aug 2018 17:46:38 -0400 Subject: [PATCH] Ensure chunks are always loaded on hard position sets Player Movement, Entity Creation and Teleportation move entities with a very "You are here, no debate" change, making the server register them as there, regardless if that chunk was loaded or not. It appears possible that with hack clients and lag, a player may be able to move fast enough to move into an unloaded chunk and get into a buggy state. To prevent this, we will ensure a chunk is always loaded, guaranteeing that the entity will be properly registered into its new home comfortably. Closes #1316 --- ...e-always-loaded-on-hard-position-set.patch | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Spigot-Server-Patches/0353-Ensure-chunks-are-always-loaded-on-hard-position-set.patch diff --git a/Spigot-Server-Patches/0353-Ensure-chunks-are-always-loaded-on-hard-position-set.patch b/Spigot-Server-Patches/0353-Ensure-chunks-are-always-loaded-on-hard-position-set.patch new file mode 100644 index 000000000..291b78e8d --- /dev/null +++ b/Spigot-Server-Patches/0353-Ensure-chunks-are-always-loaded-on-hard-position-set.patch @@ -0,0 +1,33 @@ +From 88e7c7af098c7a40518c05dbba690e037cb306d8 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 16 Aug 2018 17:36:41 -0400 +Subject: [PATCH] Ensure chunks are always loaded on hard position sets + +Player Movement, Entity Creation and Teleportation move +entities with a very "You are here, no debate" change, making +the server register them as there, regardless if that chunk was +loaded or not. + +It appears possible that with hack clients and lag, a player +may be able to move fast enough to move into an unloaded +chunk and get into a buggy state. + +To prevent this, we will ensure a chunk is always loaded, +guaranteeing that the entity will be properly registered +into its new home comfortably. + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index 9b5f7fcf72..3c279d3fe8 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -1309,6 +1309,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper + this.lastYaw -= 360.0F; + } + ++ world.getChunkAt((int) Math.floor(this.locX), (int) Math.floor(this.locZ)); // Paper - ensure chunk is always loaded + this.setPosition(this.locX, this.locY, this.locZ); + this.setYawPitch(f, f1); + } +-- +2.18.0 +