hollow-cube/entity-teleport-head-fix

This commit is contained in:
mworzala 2023-07-22 15:10:56 -04:00
parent 74ca1041f3
commit 4da527c25a
No known key found for this signature in database
GPG Key ID: B148F922E64797C7

View File

@ -333,8 +333,7 @@ public class Entity implements Viewable, Tickable, Schedulable, Snapshotable, Ev
final Pos currentPosition = this.position;
if (currentPosition.sameView(yaw, pitch)) return;
this.position = currentPosition.withView(yaw, pitch);
sendPacketToViewersAndSelf(new EntityHeadLookPacket(getEntityId(), yaw));
sendPacketToViewersAndSelf(new EntityRotationPacket(getEntityId(), yaw, pitch, onGround));
synchronizeView();
}
/**
@ -1570,6 +1569,11 @@ public class Entity implements Viewable, Tickable, Schedulable, Snapshotable, Ev
this.lastSyncedPosition = posCache;
}
private void synchronizeView() {
sendPacketToViewersAndSelf(new EntityHeadLookPacket(getEntityId(), position.yaw()));
sendPacketToViewersAndSelf(new EntityRotationPacket(getEntityId(), position.yaw(), position.pitch(), onGround));
}
/**
* Asks for a synchronization (position) to happen during next entity tick.
*/