pub struct EntityPositionSyncState {
last_sent_position: DVec3,
last_sent_on_ground: bool,
sync_delay: i32,
}Expand description
Per-entity position sync state shared by player and entity tracking.
Fields§
§last_sent_position: DVec3§last_sent_on_ground: bool§sync_delay: i32Implementations§
Source§impl EntityPositionSyncState
impl EntityPositionSyncState
Sourcepub const fn new(position: DVec3, on_ground: bool) -> Self
pub const fn new(position: DVec3, on_ground: bool) -> Self
Creates sync state at the position/on-ground state already known to 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 const fn last_sent_on_ground(self) -> bool
pub const fn last_sent_on_ground(self) -> bool
Returns the last on-ground state sent to tracking clients.
Sourcepub const fn sync_delay(self) -> i32
pub const fn sync_delay(self) -> i32
Returns the current delay since the last full position sync.
Sourcepub const fn advance_sync_delay(&mut self) -> i32
pub const fn advance_sync_delay(&mut self) -> i32
Increments the full-sync delay and returns the previous value.
Sourcepub fn position_changed(self, current_position: DVec3) -> bool
pub fn position_changed(self, current_position: DVec3) -> bool
Returns whether current_position moved far enough to sync.
Sourcepub fn packed_delta(
self,
current_position: DVec3,
) -> Option<(PackedEntityDelta, PackedEntityDelta, PackedEntityDelta)>
pub fn packed_delta( self, current_position: DVec3, ) -> Option<(PackedEntityDelta, PackedEntityDelta, PackedEntityDelta)>
Encodes the delta from the last sent position to current_position.
Returns None when any component overflows the protocol delta range and
the caller must send a full position sync instead.
Sourcepub const fn mark_delta_sent(&mut self, position: DVec3, on_ground: bool)
pub const fn mark_delta_sent(&mut self, position: DVec3, on_ground: bool)
Marks a delta movement packet as sent.
Sourcepub const fn mark_full_sent(&mut self, position: DVec3, on_ground: bool)
pub const fn mark_full_sent(&mut self, position: DVec3, on_ground: bool)
Marks a full position sync packet as sent and resets the full-sync delay.
Sourcepub const fn reset_base_without_packet(
&mut self,
position: DVec3,
on_ground: bool,
)
pub const fn reset_base_without_packet( &mut self, position: DVec3, on_ground: bool, )
Resets the delta base when vanilla updates VecDeltaCodec without a packet.
Sourcepub fn record_movement_sync(
&mut self,
position: DVec3,
on_ground: bool,
force_full: bool,
) -> EntityPositionSyncDecision
pub fn record_movement_sync( &mut self, position: DVec3, on_ground: bool, force_full: bool, ) -> EntityPositionSyncDecision
Selects and records the next movement sync form.
Callers decide whether a sync is needed and whether vanilla forces a full sync for their tracking mode. This method owns the shared protocol delta overflow fallback and updates the sync base consistently.
Trait Implementations§
Source§impl Clone for EntityPositionSyncState
impl Clone for EntityPositionSyncState
Source§fn clone(&self) -> EntityPositionSyncState
fn clone(&self) -> EntityPositionSyncState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for EntityPositionSyncState
Source§impl Debug for EntityPositionSyncState
impl Debug for EntityPositionSyncState
Source§impl PartialEq for EntityPositionSyncState
impl PartialEq for EntityPositionSyncState
impl StructuralPartialEq for EntityPositionSyncState
Auto Trait Implementations§
impl Freeze for EntityPositionSyncState
impl RefUnwindSafe for EntityPositionSyncState
impl Send for EntityPositionSyncState
impl Sync for EntityPositionSyncState
impl Unpin for EntityPositionSyncState
impl UnsafeUnpin for EntityPositionSyncState
impl UnwindSafe for EntityPositionSyncState
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
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> ⓘ
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> ⓘ
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 moreArc<SyncMutex<>>