pub struct Abilities {
pub invulnerable: bool,
pub flying: bool,
pub may_fly: bool,
pub instabuild: bool,
pub may_build: bool,
pub flying_speed: f32,
pub walking_speed: f32,
}Expand description
Player abilities that control flight, invulnerability, and other special states.
This mirrors vanilla’s Abilities class.
Fields§
§invulnerable: boolWhether the player is invulnerable to damage
flying: boolWhether the player is currently flying (creative/spectator flight)
may_fly: boolWhether the player is allowed to fly
instabuild: boolWhether the player can instantly break blocks (creative mode)
may_build: boolWhether the player can place/break blocks
flying_speed: f32Flying speed (default 0.05)
walking_speed: f32Walking speed (default 0.1)
Implementations§
Source§impl Abilities
impl Abilities
Sourcepub const fn update_for_game_mode(&mut self, game_mode: GameType)
pub const fn update_for_game_mode(&mut self, game_mode: GameType)
Updates abilities based on the given game mode.
This mirrors vanilla’s GameType.updatePlayerAbilities().
Sourcepub const fn to_packet(&self) -> CPlayerAbilities
pub const fn to_packet(&self) -> CPlayerAbilities
Converts abilities to a clientbound packet
Trait Implementations§
Source§impl From<&Abilities> for PersistentAbilities
impl From<&Abilities> for PersistentAbilities
Source§impl From<PersistentAbilities> for Abilities
impl From<PersistentAbilities> for Abilities
Source§fn from(persistent: PersistentAbilities) -> Self
fn from(persistent: PersistentAbilities) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Abilities
impl RefUnwindSafe for Abilities
impl Send for Abilities
impl Sync for Abilities
impl Unpin for Abilities
impl UnsafeUnpin for Abilities
impl UnwindSafe for Abilities
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<>>