hollow-cube/entity-teleport-head-fix

(cherry picked from commit 4da527c25a)
This commit is contained in:
mworzala 2023-07-22 15:10:56 -04:00 committed by Matt Worzala
parent ef075bec3f
commit 0208ce8193

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.
*/