Skip to main content

Packet

Enum Packet 

Source
#[non_exhaustive]
pub enum Packet {
Show 18 variants StartSneaking, StopSneaking, StartSprinting, StopSprinting, Abilities(Abilities), StartRidingJump { strength: i32, }, StopRidingJump, Flying { on_ground: bool, }, Position { x: f64, y: f64, z: f64, on_ground: bool, }, Look { yaw: f32, pitch: f32, on_ground: bool, }, Move { pos: Option<[f64; 3]>, look: Option<(f32, f32)>, on_ground: bool, horizontal_collision: bool, }, PlayerInput(Keys), PlayerLoaded, StartFallFlying, MoveVehicle { pos: [f64; 3], yaw: f32, pitch: f32, on_ground: bool, }, SteerVehicle { sideways: f32, forward: f32, jump: bool, sneak: bool, }, PaddleBoat { left: bool, right: bool, }, PositionLook { x: f64, y: f64, z: f64, yaw: f32, pitch: f32, on_ground: bool, },
}
Expand description

A movement-related packet the client sends, in the order the tick produced it.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

StartSneaking

Entity action “start sneaking”.

§

StopSneaking

Entity action “stop sneaking”.

§

StartSprinting

Entity action “start sprinting”.

§

StopSprinting

Entity action “stop sprinting”.

§

Abilities(Abilities)

Abilities update (sent when the client toggles flight).

§

StartRidingJump

Entity action “start riding jump”: the rider let go of the jump key with a mount’s jump bar charged; strength is the bar ×100 as the action’s jump-boost value.

Fields

§strength: i32

Jump strength ×100.

§

StopRidingJump

Entity action “stop riding jump” (1.9+).

§

Flying

Ground flag only.

Fields

§on_ground: bool

On ground.

§

Position

Position (y is the bounding box bottom).

Fields

§x: f64

X.

§y: f64

Feet Y (bounding box minimum).

§z: f64

Z.

§on_ground: bool

On ground.

§

Look

Rotation.

Fields

§yaw: f32

Yaw.

§pitch: f32

Pitch.

§on_ground: bool

On ground.

§

Move

A modern (26.x) movement packet: position and / or rotation (both absent = status only), on-ground and horizontal-collision flags.

Fields

§pos: Option<[f64; 3]>

Position (feet), when included.

§look: Option<(f32, f32)>

(yaw, pitch), when included.

§on_ground: bool

On ground.

§horizontal_collision: bool

Horizontal collision.

§

PlayerInput(Keys)

The modern player_input packet: the key state, sent when it changes.

§

PlayerLoaded

The 26.1 player_loaded packet: the client has loaded the level (see modern::LoadGate).

§

StartFallFlying

The modern player_command START_FALL_FLYING: the client started gliding (see modern::PlayerExt).

§

MoveVehicle

The modern vehicle_move packet: the position and rotation of the vehicle the player controls (see modern::Boat).

Fields

§pos: [f64; 3]

Position.

§yaw: f32

Yaw.

§pitch: f32

Pitch.

§on_ground: bool

The vehicle’s on-ground flag.

§

SteerVehicle

The legacy (1.9 - 1.21.1) steer_vehicle packet: the passenger’s movement input after its tick (sideways, forward after the ×0.98), jump and sneak keys.

Fields

§sideways: f32

Sideways input.

§forward: f32

Forward input.

§jump: bool

Jump key.

§sneak: bool

Sneak key.

§

PaddleBoat

The modern steer_boat (paddle) packet: the boat’s paddle states, sent every boat tick.

Fields

§left: bool

Left paddle.

§right: bool

Right paddle.

§

PositionLook

Position and rotation.

Fields

§x: f64

X.

§y: f64

Feet Y (bounding box minimum).

§z: f64

Z.

§yaw: f32

Yaw.

§pitch: f32

Pitch.

§on_ground: bool

On ground.

Trait Implementations§

Source§

impl Clone for Packet

Source§

fn clone(&self) -> Self

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 Copy for Packet

Source§

impl Debug for Packet

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Packet

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Packet

Auto Trait Implementations§

§

impl Forget for Packet

§

impl Freeze for Packet

§

impl Move for Packet

§

impl RefUnwindSafe for Packet

§

impl Send for Packet

§

impl Sync for Packet

§

impl Unpin for Packet

§

impl UnsafeUnpin for Packet

§

impl UnwindSafe for Packet

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.

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.