Do not send additional velocity packets to players

This commit is contained in:
TheMode 2021-08-11 13:23:45 +02:00
parent ae3884efdc
commit 3924d2c0a2
1 changed files with 4 additions and 4 deletions

View File

@ -526,8 +526,8 @@ public class Entity implements Viewable, Tickable, TagHandler, PermissionHandler
final var finalVelocityPosition = CollisionUtils.applyWorldBorder(instance, position, newPosition);
if (finalVelocityPosition.samePoint(position)) {
this.velocity = Vec.ZERO;
if (hasVelocity) {
sendPacketToViewersAndSelf(getVelocityPacket());
if (hasVelocity && !isSocketClient) {
sendPacketToViewers(getVelocityPacket());
}
return;
}
@ -563,8 +563,8 @@ public class Entity implements Viewable, Tickable, TagHandler, PermissionHandler
}
}
// Verify if velocity packet has to be sent
if (hasVelocity || gravityTickCount > 0) {
sendPacketToViewersAndSelf(getVelocityPacket());
if ((hasVelocity || gravityTickCount > 0) && !isSocketClient) {
sendPacketToViewers(getVelocityPacket());
}
}