pub struct EntityMovementSyncState {
position: EntityPositionSyncState,
rotation: EntityRotationSyncState,
}Expand description
Per-entity movement sync state for tracked position and rotation.
Fields§
§position: EntityPositionSyncState§rotation: EntityRotationSyncStateImplementations§
Source§impl EntityMovementSyncState
impl EntityMovementSyncState
Sourcepub const fn new(
position: DVec3,
on_ground: bool,
body_rotation: (f32, f32),
head_yaw: f32,
) -> Self
pub const fn new( position: DVec3, on_ground: bool, body_rotation: (f32, f32), head_yaw: f32, ) -> Self
Creates movement sync state for values already known to tracking clients.
Sourcepub const fn last_sent_position(self) -> DVec3
pub const fn last_sent_position(self) -> DVec3
Returns the last absolute position used as the client’s delta base.
Sourcepub fn record_position_sync_with_full_delay(
&mut self,
position: DVec3,
on_ground: bool,
full_sync_delay: i32,
) -> EntityPositionSyncDecision
pub fn record_position_sync_with_full_delay( &mut self, position: DVec3, on_ground: bool, full_sync_delay: i32, ) -> EntityPositionSyncDecision
Selects and records a position sync that forces full packets after a delay.
Vanilla player movement uses this form: delta packets are sent while the packed delta base is fresh, then a full position sync refreshes that base.
Sourcepub fn record_update_with_full_delay(
&mut self,
update: EntityMovementSyncUpdate,
full_sync_delay: i32,
) -> EntityMovementSyncPackets
pub fn record_update_with_full_delay( &mut self, update: EntityMovementSyncUpdate, full_sync_delay: i32, ) -> EntityMovementSyncPackets
Selects and records packets for a tracked movement update.
Sourcepub fn record_body_rotation(
&mut self,
rotation: (f32, f32),
) -> Option<PackedEntityRotation>
pub fn record_body_rotation( &mut self, rotation: (f32, f32), ) -> Option<PackedEntityRotation>
Records a body rotation packet when the packed yaw or pitch changed.
Sourcepub const fn mark_body_rotation_sent(&mut self, rotation: (f32, f32))
pub const fn mark_body_rotation_sent(&mut self, rotation: (f32, f32))
Marks body rotation as sent because a full position sync includes it.
Sourcepub const fn record_head_yaw(&mut self, head_yaw: f32) -> Option<i8>
pub const fn record_head_yaw(&mut self, head_yaw: f32) -> Option<i8>
Records a head-rotation packet when the packed yaw changed.
Trait Implementations§
Source§impl Clone for EntityMovementSyncState
impl Clone for EntityMovementSyncState
Source§fn clone(&self) -> EntityMovementSyncState
fn clone(&self) -> EntityMovementSyncState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for EntityMovementSyncState
Source§impl Debug for EntityMovementSyncState
impl Debug for EntityMovementSyncState
Source§impl PartialEq for EntityMovementSyncState
impl PartialEq for EntityMovementSyncState
impl StructuralPartialEq for EntityMovementSyncState
Auto Trait Implementations§
impl Freeze for EntityMovementSyncState
impl RefUnwindSafe for EntityMovementSyncState
impl Send for EntityMovementSyncState
impl Sync for EntityMovementSyncState
impl Unpin for EntityMovementSyncState
impl UnsafeUnpin for EntityMovementSyncState
impl UnwindSafe for EntityMovementSyncState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>