Only synchronize position if entity has been affected by its velocity

This commit is contained in:
TheMode 2021-07-13 17:51:29 +02:00
parent 86472003f8
commit a7b0b2685b

View File

@ -523,6 +523,9 @@ public class Entity implements Viewable, Tickable, EventHandler<EntityEvent>, Da
// Apply the position if changed // Apply the position if changed
if (!finalVelocityPosition.samePoint(position)) { if (!finalVelocityPosition.samePoint(position)) {
refreshPosition(finalVelocityPosition, true); refreshPosition(finalVelocityPosition, true);
if (!isNettyClient) {
synchronizePosition(true);
}
} }
// Update velocity // Update velocity
@ -548,10 +551,6 @@ public class Entity implements Viewable, Tickable, EventHandler<EntityEvent>, Da
} }
} }
// Synchronization and packets...
if (!isNettyClient) {
synchronizePosition(true);
}
// Verify if velocity packet has to be sent // Verify if velocity packet has to be sent
if (hasVelocity() || (!isNettyClient && gravityTickCount > 0)) { if (hasVelocity() || (!isNettyClient && gravityTickCount > 0)) {
sendPacketToViewersAndSelf(getVelocityPacket()); sendPacketToViewersAndSelf(getVelocityPacket());