pub struct Entities { /* private fields */ }Expand description
The tracked entities and tab list (queries are the same for every version).
Implementations§
Source§impl Entities
impl Entities
Sourcepub fn get(&self, id: i32) -> Option<&Entity>
pub fn get(&self, id: i32) -> Option<&Entity>
The entity with this id (including the bot’s own entry, see Entities::self_id).
Sourcepub fn iter(&self) -> impl Iterator<Item = &Entity>
pub fn iter(&self) -> impl Iterator<Item = &Entity>
Other entities (the bot’s own entry is skipped), arbitrary order.
Sourcepub fn self_id(&self) -> Option<i32>
pub fn self_id(&self) -> Option<i32>
The bot’s own entity id (from login). Its entry carries metadata, equipment, riding
state and effects as far as the Config keeps them, but no position: the client
owns its own position. The ghast client tracks entities with Config::effects and
Config::equipment off: use TickContext::effects for the bot’s own effects.
Sourcepub fn me(&self) -> Option<&Entity>
pub fn me(&self) -> Option<&Entity>
The bot’s own entry (see Entities::self_id for what it carries).
Sourcepub fn within(&self, p: [f64; 3], radius: f64) -> impl Iterator<Item = &Entity>
pub fn within(&self, p: [f64; 3], radius: f64) -> impl Iterator<Item = &Entity>
Entities whose server position is within radius of p (linear scan).
Sourcepub fn near(&self, p: [f64; 3], radius: f64) -> impl Iterator<Item = &Entity>
pub fn near(&self, p: [f64; 3], radius: f64) -> impl Iterator<Item = &Entity>
Alias of Entities::within.
Sourcepub fn player_info(&self, uuid: &Uuid) -> Option<&PlayerInfo>
pub fn player_info(&self, uuid: &Uuid) -> Option<&PlayerInfo>
The tab list.
Sourcepub fn players(&self) -> impl Iterator<Item = (&Uuid, &PlayerInfo)>
pub fn players(&self) -> impl Iterator<Item = (&Uuid, &PlayerInfo)>
All tab-list entries.
Sourcepub fn player_name(&self, id: i32) -> Option<&str>
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).
Sourcepub fn tab_name(&self, uuid: &Uuid) -> Option<&str>
pub fn tab_name(&self, uuid: &Uuid) -> Option<&str>
Profile name of a tab-list entry (full list or names only).
Sourcepub fn client_motion(&self, id: i32) -> Option<[f64; 3]>
pub fn client_motion(&self, id: i32) -> Option<[f64; 3]>
The motion (getDeltaMovement) of the client copy of entity id when its type is one of
Config::motion_types: zero once it has run out (or was never set), None for other
types and unknown ids. Modern (26.x) trackers only.
Sourcepub fn tab_uuid(&self, name: &str) -> Option<Uuid>
pub fn tab_uuid(&self, name: &str) -> Option<Uuid>
The uuid of the tab-list entry (full list or names only) with profile name name.
Sourcepub fn tab_game_mode(&self, uuid: &Uuid) -> Option<i32>
pub fn tab_game_mode(&self, uuid: &Uuid) -> Option<i32>
Game mode of a tab-list entry (full list or names only).
Sourcepub fn tab_generation(&self, uuid: &Uuid) -> Option<u32>
pub fn tab_generation(&self, uuid: &Uuid) -> Option<u32>
26.x: the generation of uuid’s tab-list object (a new number each time the server
adds the entry): a player entity that looked its entry up keeps reading that object
(v26_x::tab_generation) while it is in the list.
Sourcepub fn drain_events(&mut self) -> Drain<'_, Event> ⓘ
pub fn drain_events(&mut self) -> Drain<'_, Event> ⓘ
Takes the queued events (keeps the buffer’s capacity).
Sourcepub fn set_tick(&mut self, now: u64)
pub fn set_tick(&mut self, now: u64)
Sets the clock that stamps Entity::position_tick, Entity::spawn_tick and
Entity::last_hurt_tick (the ghast client sets it to the tick in which the behaviour
first sees the packets that follow).
Sourcepub fn tick(&self) -> u64
pub fn tick(&self) -> u64
The clock set with Entities::set_tick.