From a7b0b2685bc42592ae6b3695aa8b5148a88b5908 Mon Sep 17 00:00:00 2001 From: TheMode Date: Tue, 13 Jul 2021 17:51:29 +0200 Subject: [PATCH] Only synchronize position if entity has been affected by its velocity --- src/main/java/net/minestom/server/entity/Entity.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/minestom/server/entity/Entity.java b/src/main/java/net/minestom/server/entity/Entity.java index 4929b37f5..cf063039b 100644 --- a/src/main/java/net/minestom/server/entity/Entity.java +++ b/src/main/java/net/minestom/server/entity/Entity.java @@ -523,6 +523,9 @@ public class Entity implements Viewable, Tickable, EventHandler, Da // Apply the position if changed if (!finalVelocityPosition.samePoint(position)) { refreshPosition(finalVelocityPosition, true); + if (!isNettyClient) { + synchronizePosition(true); + } } // Update velocity @@ -548,10 +551,6 @@ public class Entity implements Viewable, Tickable, EventHandler, Da } } - // Synchronization and packets... - if (!isNettyClient) { - synchronizePosition(true); - } // Verify if velocity packet has to be sent if (hasVelocity() || (!isNettyClient && gravityTickCount > 0)) { sendPacketToViewersAndSelf(getVelocityPacket());