Skip to main content

Entities

Struct Entities 

Source
pub struct Entities { /* private fields */ }
Expand description

The tracked entities and tab list (queries are the same for every version).

Implementations§

Source§

impl Entities

Source

pub fn get(&self, id: i32) -> Option<&Entity>

The entity with this id (including the bot’s own entry, see Entities::self_id).

Source

pub fn len(&self) -> usize

Number of tracked entities (including the bot’s own entry).

Source

pub fn is_empty(&self) -> bool

true when nothing is tracked.

Source

pub fn iter(&self) -> impl Iterator<Item = &Entity>

Other entities (the bot’s own entry is skipped), arbitrary order.

Source

pub fn self_id(&self) -> Option<i32>

The bot’s own entity id (from login). Its entry carries metadata, effects, equipment and riding state, but no position: the client owns its own position.

Source

pub fn me(&self) -> Option<&Entity>

The bot’s own entry.

Source

pub fn within(&self, p: [f64; 3], radius: f64) -> impl Iterator<Item = &Entity>

Entities whose server position is within radius of p (linear scan).

Source

pub fn near(&self, p: [f64; 3], radius: f64) -> impl Iterator<Item = &Entity>

Alias of Entities::within.

Source

pub fn player_info(&self, uuid: &Uuid) -> Option<&PlayerInfo>

The tab list.

Source

pub fn players(&self) -> impl Iterator<Item = (&Uuid, &PlayerInfo)>

All tab-list entries.

Source

pub fn player_name(&self, id: i32) -> Option<&str>

Name of a player entity (from the tab list: the full one, or the names-only one of Config::player_names).

Source

pub fn tab_name(&self, uuid: &Uuid) -> Option<&str>

Profile name of a tab-list entry (full list or names only).

Source

pub fn tab_game_mode(&self, uuid: &Uuid) -> Option<i32>

Game mode of a tab-list entry (full list or names only).

Source

pub fn tab_len(&self) -> usize

Number of tab-list entries kept (full list or names only).

Source

pub fn config(&self) -> Config

The configuration.

Source

pub fn drain_events(&mut self) -> Drain<'_, Event> ⓘ

Takes the queued events (keeps the buffer’s capacity).

Source

pub fn clear(&mut self)

Removes every entity (keeps the tab list and the bot’s id).

Trait Implementations§

Source§

impl Clone for Entities

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 Debug for Entities

Source§

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

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

impl Default for Entities

Source§

fn default() -> Self

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

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