Skip to main content

TickEvents

Struct TickEvents 

Source
#[non_exhaustive]
pub struct TickEvents {
Show 14 fields pub chat: Vec<ChatMessage>, pub chat_dropped: usize, pub teleported: bool, pub teleports: Vec<TeleportEvent>, pub joined: bool, pub respawned: bool, pub died: bool, pub health_changed: bool, pub game_mode_changed: bool, pub inventory: Events, pub block_updates: Vec<(BlockPos, u32)>, pub block_updates_dropped: usize, pub raw: Vec<RawInbound>, pub raw_dropped: usize, /* private fields */
}
Expand description

What happened since the behaviour’s previous tick.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§chat: Vec<ChatMessage>

Chat messages in arrival order (only with Interests::CHAT).

§chat_dropped: usize

Chat messages dropped because too many piled up while the behaviour was not ticking.

§teleported: bool

The server teleported / corrected the player.

§teleports: Vec<TeleportEvent>

Every teleport in arrival order, with the sent pose before it (at most 64 per tick).

§joined: bool

A join game packet arrived (first join or a proxy server switch).

§respawned: bool

The player respawned or changed dimension.

§died: bool

The player died (health reached 0).

§health_changed: bool

Health, food or saturation changed.

§game_mode_changed: bool

The game mode changed.

§inventory: Events

Inventory / window changes and click results (ghast-inventory).

§block_updates: Vec<(BlockPos, u32)>

Block changes in arrival order (only with Interests::BLOCK_UPDATES): position and the version’s raw block state (1.8 id << 4 | meta, 1.16 the global palette id). The world already holds them when the behaviour ticks.

§block_updates_dropped: usize

Block changes dropped because too many piled up between two behaviour ticks.

§raw: Vec<RawInbound>

The packets asked for with Behavior::raw_packets, in arrival order (kept while the behaviour is on hold, like chat).

§raw_dropped: usize

Raw packets dropped because more than 4096 piled up between two behaviour ticks.

Implementations§

Source§

impl TickEvents

Source

pub fn effects(&self) -> &[EffectEvent]

Our status effects: every entity_effect / remove_entity_effect for us in arrival order (a re-application with the same values is an Applied too), and Cleared when a new player entity drops them (join, respawn). See TickContext::effects.

Source

pub fn hurt(&self) -> &[Hurt]

We were hurt (1.8 – 1.16.5 the hurt entity statuses for our entity, 26.x its damage_event), in arrival order.

Source

pub fn knockback(&self) -> &[Knockback]

The server’s pushes on us, in arrival order: our own entity’s velocity packets (an attack’s knockback among them) and explosion pushes (at most 64 between two behaviour ticks). The movement already uses them (TickContext::velocity).

Source

pub fn deaths(&self) -> &[Death]

Player deaths the server announced (ours: it sends them only to the dead player), with the killer where the version sends one.

Source

pub fn entities(&self) -> &[Event]

Entity changes in arrival order (only with Interests::ENTITY_EVENTS and entity tracking): spawns (a re-spawn with the same id is a Removed then a Spawned), removals, moves, velocity, statuses, ghast_entity::Event::Hurt (the bot’s own entity included), metadata, riding, pickups. Kept while the behaviour is on hold, at most 4096.

Source

pub fn entities_dropped(&self) -> usize

Entity events dropped because more than 4096 piled up between two behaviour ticks.

Source

pub fn item_use(&self) -> &[UseEvent]

Our item use’s steps in order (at most 64 between two behaviour ticks): started by the right button’s key handling, finished by the server (entity status 9), released, or interrupted (see crate::common::UseEvent). A use started and ended in the key handling after the behaviour’s tick shows up on the next tick, like TickContext::using_item.

Source

pub fn cooldowns(&self) -> &[CooldownEvent]

Our item cooldowns’ starts (the server’s set_cooldown or our own item use) and ends, in order (1.9+; at most 64 between two behaviour ticks). See crate::cooldown; TickContext::item_cooldowns holds them now.

Source

pub fn hud(&self) -> &[HudEvent]

HUD changes in arrival order (only with Interests::HUD): boss bars, titles, the action bar, the tab list’s header and footer, and the countdowns running out (see crate::hud). Kept while the behaviour is on hold, at most 256.

Source

pub fn hud_dropped(&self) -> usize

HUD events dropped because more than 256 piled up between two behaviour ticks.

Source

pub fn tab_completions(&self) -> &[TabCompletion]

The server’s answers to tab-completion requests (TickContext::tab_complete), in arrival order (at most 64 between two behaviour ticks).

Source

pub fn signs(&self) -> &[SignEvent]

The sign editor’s events, in order (crate::sign; the open editor is crate::TickContext::sign_editor).

Source

pub fn sleep(&self) -> &[SleepEvent]

The player fell asleep or woke up, in order (crate::TickContext::sleeping is the state now).

Source

pub fn fishing(&self) -> &[FishingEvent]

Our fishing bobber’s changes, in arrival order: cast, bite, bite over, hooked, gone (with entity tracking; see crate::fishing; crate::TickContext::fishing is the bobber now). At most 64 between two behaviour ticks.

Trait Implementations§

Source§

impl Clone for TickEvents

Source§

fn clone(&self) -> TickEvents

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 TickEvents

Source§

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

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

impl Default for TickEvents

Source§

fn default() -> TickEvents

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

impl PartialEq for TickEvents

Source§

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

Auto Trait Implementations§

§

impl Forget for TickEvents

§

impl Freeze for TickEvents

§

impl Move for TickEvents

§

impl RefUnwindSafe for TickEvents

§

impl Send for TickEvents
where RawVecInner: Send, Bytes: Send, BoxRaw<MoreEvents>: Send,

§

impl Sync for TickEvents
where RawVecInner: Sync, Bytes: Sync, BoxRaw<MoreEvents>: Sync,

§

impl Unpin for TickEvents
where *const u8 is !null: Unpin, *const u8: Unpin, Align8<*mut ()>: Unpin, &'static Vtable: Unpin, Box<MoreEvents>: Unpin,

§

impl UnsafeUnpin for TickEvents

§

impl UnwindSafe for TickEvents
where RawVecInner: UnwindSafe, *const u8: UnwindSafe, Align8<*mut ()>: UnwindSafe, &'static Vtable: UnwindSafe, BoxRaw<MoreEvents>: UnwindSafe,

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