pub struct Idle;Expand description
A behaviour that does nothing (the player stands still).
Trait Implementations§
Source§impl Behavior for Idle
impl Behavior for Idle
Source§fn tick(&mut self, _ctx: &mut TickContext<'_>)
fn tick(&mut self, _ctx: &mut TickContext<'_>)
Called every tick while the player is in the world and the server is answering.
Source§fn interests(&self) -> Interests
fn interests(&self) -> Interests
Optional packet groups this behaviour needs. Read every tick; a change updates the
packet filter. Everything not asked for is dropped before it is decoded.
Source§fn raw_packets(&self, version: GameVersion) -> Cow<'static, [i32]>
fn raw_packets(&self, version: GameVersion) -> Cow<'static, [i32]>
Extra clientbound play packet ids (of
version) to copy undecoded into
TickEvents::raw, including packets the core consumes itself (the core’s handling
does not change). Read every tick like Behavior::interests; a change updates the
packet filter. Decoding is the behaviour’s job (ghast::protocol::v1_8::play::clientbound
/ v1_16_5).Source§fn start(&mut self, ctx: &mut TickContext<'_>)
fn start(&mut self, ctx: &mut TickContext<'_>)
Called on the first tick the player is in the world, before that tick’s
Behavior::tick (both see the same events).Source§fn running(&self) -> bool
fn running(&self) -> bool
Whether the behaviour still wants ticks. Once it returns
false the behaviour is done:
it is not ticked again (the player keeps standing and answering the server) and
Behavior::stop still runs when the session ends. Read after every start / tick.Source§fn after_tick(&mut self, view: &TickView<'_>)
fn after_tick(&mut self, view: &TickView<'_>)
Called after every tick’s movement step (also while the behaviour is on hold or has
finished), with a read-only view of what the server now has: the pose sent this tick,
the world, entities and inventory. For observers (a viewer, a recorder); it cannot act.
Default: nothing. Read more
impl Copy for Idle
Auto Trait Implementations§
impl Freeze for Idle
impl RefUnwindSafe for Idle
impl Send for Idle
impl Sync for Idle
impl Unpin for Idle
impl UnsafeUnpin for Idle
impl UnwindSafe for Idle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more