Skip to main content

GameVersion

Enum GameVersion 

Source
#[non_exhaustive]
pub enum GameVersion { V1_8_9, V1_12_2, V1_16_5, V26_1, V26_2, }
Expand description

A protocol version the client supports, chosen at run time.

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.
§

V1_8_9

1.8 – 1.8.9 (protocol 47).

§

V1_12_2

1.12.2 (protocol 340).

§

V1_16_5

1.16.4 – 1.16.5 (protocol 754).

§

V26_1

26.1 – 26.1.2 (protocol 775).

§

V26_2

26.2 (protocol 776).

Implementations§

Source§

impl GameVersion

Source

pub const ALL: &'static [GameVersion]

Every supported version, oldest first. A slice, so that adding a version is not a breaking change.

Source

pub const fn caps(self) -> &'static Capabilities

What this version can do (the row the client core reads instead of comparing versions).

Source

pub const fn enabled(self) -> bool

Whether this build of the library includes the version (its cargo feature is on).

Source

pub const fn protocol(self) -> i32

Protocol number.

Source

pub fn protocol_info(self) -> &'static ProtocolVersion

This version’s row in the protocol table (ghast_protocol::versions): module, feature, every game version sharing the protocol number, wire facts (the row exists whether or not the version is compiled in; see its enabled).

Source

pub const fn name(self) -> &'static str

Display name ("1.8.9", "1.12.2", "1.16.5").

Source

pub const fn combat_1_9(self) -> bool

true for 1.9 and later: the attack cooldown, the off hand, swinging after the click, no 0.1 targeting border on entity boxes (Capabilities::combat_1_9).

Source

pub const fn eye_height(self) -> f64

Eye height above the feet while standing (Capabilities::eye_height).

Source

pub const fn sneak_eye_height(self) -> f64

Eye height while sneaking: 1.54 in 1.8 – 1.12 (getEyeHeight − 0.08), 1.27 in 1.16 (the crouching pose) (Capabilities::sneak_eye_height).

Trait Implementations§

Source§

impl Clone for GameVersion

Source§

fn clone(&self) -> GameVersion

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 GameVersion

Source§

impl Debug for GameVersion

Source§

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

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

impl Display for GameVersion

Source§

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

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

impl Eq for GameVersion

Source§

impl FromStr for GameVersion

Source§

fn from_str(s: &str) -> Result<GameVersion, <GameVersion as FromStr>::Err>

Accepts 1.8, 1.8.x, 47, 1.12.2, 340, 1.16.4, 1.16.5, 754, 26.1, 26.1.1, 26.1.2, 775, 26.2 and 776.

Source§

type Err = UnknownVersion

The associated error which can be returned from parsing.
Source§

impl Hash for GameVersion

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for GameVersion

Source§

fn eq(&self, other: &GameVersion) -> 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 GameVersion

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

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

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

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> PolicyExt for T
where T: ?Sized,

Source§

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

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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