Base

Struct Base 

Source
pub struct Base {
Show 20 fields pub persistent: bool, pub size: Size, pub bb: BoundingBox, pub pos: DVec3, pub vel: DVec3, pub look: Vec2, pub lifetime: u32, pub eye_height: f32, pub can_pickup: bool, pub no_clip: bool, pub on_ground: bool, pub in_water: bool, pub in_lava: bool, pub fall_distance: f32, pub fire_time: u32, pub air_time: u32, pub hurt: Vec<Hurt>, pub rider_id: Option<u32>, pub bobber_id: Option<u32>, pub rand: JavaRandom,
}
Expand description

The base data common to all entities.

Fields§

§persistent: bool

Tell if this entity is persistent or not. A persistent entity is saved with its chunk, but non-persistent entities are no saved. For example, all player entities are typically non-persistent because these are not real entities. Some entities cannot be persistent as they are not supported by the Notchian serialization.

§size: Size

The last size that was used when recomputing the bounding box based on the position, we keep it in order to check that the bounding box don’t shift too far from it because of rounding errors, and also to keep the height center. This is updated with the bounding box by tick_base method when entity isn’t coherent.

§bb: BoundingBox

The bounding box is defining the actual position from the size of the entity, the actual position of the entity is derived from it. This is recomputed with the size by tick_base method when entity isn’t coherent.

§pos: DVec3

The current entity position, it is derived from the bounding box and size, it can be forced by setting it and then calling resize on entity.

§vel: DVec3

True if an entity pos event should be sent after update. The current entity velocity.

§look: Vec2

Yaw a pitch angles of this entity’s look. These are in radians with no range guarantee, although this will often be normalized in 2pi range. The yaw angle in Minecraft is set to zero when pointing toward PosZ, and then rotate clockwise to NegX, NegZ and then PosX.

Yaw is X and pitch is Y.

§lifetime: u32

Lifetime of the entity since it was spawned in the world, it increase at every world tick.

§eye_height: f32

Height of the eyes, this is an Y offset from the position.

§can_pickup: bool

Set to true when the entity is able to pickup surrounding items and arrows on ground, if so a pickup event is triggered, but the item or arrow is not actually picked up, it’s up to the event listener to decide. Disabled by default.

§no_clip: bool

No clip is used to disable collision check when moving the entity, if no clip is false, then the entity will be constrained by bounding box in its way.

§on_ground: bool

Is this entity currently on ground.

§in_water: bool

Is this entity in water.

§in_lava: bool

Is this entity in lava.

§fall_distance: f32

Total fall distance, will be used upon contact to calculate damages to deal.

§fire_time: u32

Remaining fire ticks.

§air_time: u32

Remaining air ticks to breathe.

§hurt: Vec<Hurt>

A list of hurts to apply to the entity.

§rider_id: Option<u32>

If this entity is ridden, this contains its entity id.

§bobber_id: Option<u32>

If this entity has thrown a bobber for fishing, this contains its entity id.

§rand: JavaRandom

The random number generator used for this entity.

Trait Implementations§

Source§

impl Clone for Base

Source§

fn clone(&self) -> Base

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Base

Source§

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

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

impl Default for Base

Source§

fn default() -> Base

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Base

§

impl RefUnwindSafe for Base

§

impl Send for Base

§

impl Sync for Base

§

impl Unpin for Base

§

impl UnwindSafe for Base

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