Skip to main content

VanillaEntitySize

Struct VanillaEntitySize 

Source
pub struct VanillaEntitySize {
    pub name: &'static str,
    pub registry_id: i32,
    pub spawn: &'static str,
    pub object_types: &'static [(i32, i32)],
    pub targeting_margin: f32,
    pub fixed: bool,
    pub registered: Option<(f32, f32)>,
    pub variants: &'static [EntityVariant],
    pub poses: &'static [(&'static str, EntityDimensions)],
}
Expand description

Vanilla sizes of one entity type, measured by the oracle on the client, spawned the way the client spawns it from its packet, then metadata-dependent variants applied like the client does (oracle/README.md, “entity_sizes.jsonl.gz”).

Boxes: EntityDimensions::bounding_box is the centred box vanilla builds on spawn and every position update. Hanging entities (paintings, item frames) build their box from facing and motive instead, and vanilla’s resize keeps the old min corner until the next position update.

Fields§

§name: &'static str

Name: 1.8 legacy registry name ("Zombie", "PigZombie", "Player"), 1.16 registry path ("zombie", "player").

§registry_id: i32

Vanilla registry id (1.8 EntityType id = the spawn-mob type for mobs; 1.16 registry id); -1 when the type has none (1.8 players, lightning, fishing bobber) or no client instance.

§spawn: &'static str

1.8 spawn packet kind: "mob", "object", "xp_orb", "painting", "global", "player"; empty for 1.16.

§object_types: &'static [(i32, i32)]

1.8 spawn-object packet (type, data) pairs that create this entity (minecart kinds share type 10 with different data).

§targeting_margin: f32

Extra growth of the box when picking entities with the crosshair (getTargetingMargin).

§fixed: bool

1.16 EntityDimensions.fixed (not scaled for babies); false in 1.8.

§registered: Option<(f32, f32)>

1.16 registered type dimensions (width, height); None in 1.8.

§variants: &'static [EntityVariant]

Measured variants, "default" first.

§poses: &'static [(&'static str, EntityDimensions)]

1.16 player: dimensions per pose ("standing", "crouching", "swimming", …).

Implementations§

Source§

impl VanillaEntitySize

Source

pub fn variant(&self, name: &str) -> Option<&'static EntityVariant>

A measured variant by name.

Source

pub fn default_dimensions(&self) -> Option<EntityDimensions>

The size right after spawning (None for 1.16 types without a client instance; use VanillaEntitySize::registered).

Source

pub fn baby(&self) -> Option<EntityDimensions>

The "baby" variant as the client applies it, for types that have one.

Source

pub fn pose(&self, name: &str) -> Option<EntityDimensions>

1.16 player dimensions for a pose.

Trait Implementations§

Source§

impl Clone for VanillaEntitySize

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 VanillaEntitySize

Source§

impl Debug for VanillaEntitySize

Source§

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

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

impl PartialEq for VanillaEntitySize

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 VanillaEntitySize

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.

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.