Skip to main content

PersistentPlayerData

Struct PersistentPlayerData 

Source
pub struct PersistentPlayerData {
Show 29 fields pub pos: [f64; 3], pub motion: [f64; 3], pub rotation: [f32; 2], pub on_ground: bool, pub fall_flying: bool, pub remaining_fire_ticks: i32, pub ticks_frozen: i32, pub is_in_powder_snow: bool, pub was_in_powder_snow: bool, pub has_visual_fire: bool, pub health: f32, pub game_mode: i32, pub prev_game_mode: Option<i32>, pub abilities: PersistentAbilities, pub inventory: Vec<PersistentSlot>, pub selected_slot: i32, pub world: String, pub food_level: i32, pub food_saturation_level: f32, pub food_exhaustion_level: f32, pub food_tick_timer: i32, pub data_version: i32, pub experience_level: i32, pub experience_progress: f32, pub experience_total: i32, pub score: i32, pub seen_credits: bool, pub root_vehicle: Option<PersistentRootVehicle>, pub ender_pearls: Vec<PersistentEnderPearl>,
}
Expand description

Persistent player data saved by Steel’s storage backend.

This is Steel’s runtime save snapshot. Vanilla import/export should live outside server runtime storage so compatibility logic does not constrain the native format.

Fields§

§pos: [f64; 3]

Position (x, y, z) in absolute world coordinates.

§motion: [f64; 3]

Velocity (x, y, z) in blocks per tick.

§rotation: [f32; 2]

Rotation (yaw, pitch) in degrees.

§on_ground: bool

Whether the player is on the ground.

§fall_flying: bool

Whether the player is elytra gliding.

§remaining_fire_ticks: i32

Vanilla remainingFireTicks.

§ticks_frozen: i32

Synchronized vanilla TicksFrozen.

§is_in_powder_snow: bool

Vanilla isInPowderSnow.

§was_in_powder_snow: bool

Vanilla wasInPowderSnow.

§has_visual_fire: bool

Vanilla hasVisualFire.

§health: f32

Current health points.

§game_mode: i32

Current game mode (0=survival, 1=creative, 2=adventure, 3=spectator).

§prev_game_mode: Option<i32>

Previous game mode of the player, or None if vanilla has not recorded one yet.

§abilities: PersistentAbilities

Player abilities (flight, invulnerability, etc.).

§inventory: Vec<PersistentSlot>

Inventory items with slot indices.

§selected_slot: i32

Currently selected hotbar slot (0-8).

§world: String

Loaded world identifier (e.g., “minecraft:overworld”).

§food_level: i32

Current food level (0–20, default 20).

§food_saturation_level: f32

Food saturation level (0.0–food_level, default 5.0).

§food_exhaustion_level: f32

Accumulated food exhaustion (0.0–40.0, default 0.0).

§food_tick_timer: i32

Internal tick timer for regen/starvation (default 0).

§data_version: i32

Data version for format migrations.

§experience_level: i32

Current experience level

§experience_progress: f32

Vanilla progress toward the next experience level.

§experience_total: i32

Vanilla Player.totalExperience, updated by point grants but independent of level/progress.

§score: i32

Vanilla death-screen score. Point grants change it with Java int wrapping.

§seen_credits: bool

Vanilla ServerPlayer.seenCredits.

§root_vehicle: Option<PersistentRootVehicle>

Vanilla one-player root vehicle tree stored with the player instead of chunk data.

§ender_pearls: Vec<PersistentEnderPearl>

Vanilla in-flight ender pearls stored with the player (ServerPlayer.enderPearls).

Implementations§

Source§

impl PersistentPlayerData

Source

pub fn from_player(player: &Player) -> Self

Extracts persistent data from a live player.

Source

fn ender_pearls_from_player(player: &Player) -> Vec<PersistentEnderPearl>

Snapshots the player’s live in-flight ender pearls for persistence.

Source

fn root_vehicle_from_player(player: &Player) -> Option<PersistentRootVehicle>

Source§

impl PersistentPlayerData

Source

pub fn apply_to_player(&self, player: &Player)

Applies the saved data to a player.

This restores position, rotation, inventory, abilities, etc.

Source

pub fn apply_to_player_without_location(&self, player: &Player)

Applies saved gameplay state without restoring world-local location data.

Used when the saved world is unavailable or differs from an explicitly selected world, which must use the target spawn instead.

Source

fn apply_to_player_inner(&self, player: &Player, restore_location: bool)

Trait Implementations§

Source§

impl Clone for PersistentPlayerData

Source§

fn clone(&self) -> PersistentPlayerData

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PersistentPlayerData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> IntoShared for T

Source§

fn into_shared(self) -> Arc<Mutex<RawMutex, Self>>

Wraps this value in an Arc<SyncMutex<>>
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more