diff options
| author | mat <git@matdoes.dev> | 2025-03-20 03:35:59 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-03-20 03:35:59 +0000 |
| commit | aa2039c86888e8ef47072fde63634ec58b22a654 (patch) | |
| tree | bc69430f3e0f0d488d6154b72addfc80bbe563a7 /azalea-client/src | |
| parent | 5c7332b4692986f8c0ca969d79a6eb39feca686a (diff) | |
| download | azalea-drasl-aa2039c86888e8ef47072fde63634ec58b22a654.tar.xz | |
upgrade deps and slightly improve docs
Diffstat (limited to 'azalea-client/src')
| -rw-r--r-- | azalea-client/src/client.rs | 6 | ||||
| -rw-r--r-- | azalea-client/src/plugins/events.rs | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index 05c529b8..f18de86d 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -688,7 +688,11 @@ impl Client { /// receives the login packet, its true position may be set ticks /// later. pub fn position(&self) -> Vec3 { - Vec3::from(&self.component::<Position>()) + Vec3::from( + &self + .get_component::<Position>() + .expect("the client's position hasn't been initialized yet"), + ) } /// Get the position of this client's eyes. diff --git a/azalea-client/src/plugins/events.rs b/azalea-client/src/plugins/events.rs index 011fbc4a..32e393da 100644 --- a/azalea-client/src/plugins/events.rs +++ b/azalea-client/src/plugins/events.rs @@ -60,6 +60,7 @@ use crate::{ /// Note: Events are sent before they're processed, so for example game ticks /// happen at the beginning of a tick before anything has happened. #[derive(Debug, Clone)] +#[non_exhaustive] pub enum Event { /// Happens right after the bot switches into the Game state, but before /// it's actually spawned. This can be useful for setting the client @@ -72,8 +73,8 @@ pub enum Event { /// Fired when we receive a login packet, which is after [`Event::Init`] but /// before [`Event::Spawn`]. You usually want [`Event::Spawn`] instead. /// - /// Your position will be [`Vec3::ZERO`] immediately after you receive this - /// packet, but it'll be ready by the time you get [`Event::Spawn`]. + /// Your position may be [`Vec3::ZERO`] immediately after you receive this + /// event, but it'll be ready by the time you get [`Event::Spawn`]. /// /// [`Vec3::ZERO`]: azalea_core::position::Vec3::ZERO Login, |
