1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

document Position default

This commit is contained in:
mat 2025-03-20 01:49:15 +00:00
parent 75efbc83fd
commit 13d5cbed1f
3 changed files with 10 additions and 3 deletions

View file

@ -683,6 +683,10 @@ impl Client {
/// Get the position of this client. /// Get the position of this client.
/// ///
/// This is a shortcut for `Vec3::from(&bot.component::<Position>())`. /// This is a shortcut for `Vec3::from(&bot.component::<Position>())`.
///
/// Note that this value is given a default of [`Vec3::ZERO`] when it
/// receives the login packet, its true position may be set ticks
/// later.
pub fn position(&self) -> Vec3 { pub fn position(&self) -> Vec3 {
Vec3::from(&self.component::<Position>()) Vec3::from(&self.component::<Position>())
} }

View file

@ -297,7 +297,7 @@ impl GamePacketHandler<'_> {
let entity_bundle = EntityBundle::new( let entity_bundle = EntityBundle::new(
game_profile.uuid, game_profile.uuid,
Vec3::default(), Vec3::ZERO,
azalea_registry::EntityKind::Player, azalea_registry::EntityKind::Player,
new_instance_name, new_instance_name,
); );

View file

@ -140,8 +140,11 @@ impl Debug for EntityUuid {
/// The position of the entity right now. /// The position of the entity right now.
/// ///
/// You are free to change this; there's systems that update the indexes /// You are free to change the value of this component; there's systems that
/// automatically. /// update the indexes automatically.
///
/// Its value is set to a default of [`Vec3::ZERO`] when it receives the login
/// packet, its true position may be set ticks later.
#[derive(Component, Clone, Copy, Debug, Default, PartialEq, Deref, DerefMut)] #[derive(Component, Clone, Copy, Debug, Default, PartialEq, Deref, DerefMut)]
pub struct Position(Vec3); pub struct Position(Vec3);
impl Position { impl Position {