aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/player.rs
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-06-24 23:10:59 -0500
committermat <github@matdoes.dev>2022-06-24 23:10:59 -0500
commitb030b0ea330c674415f7e30634957167b2fa6a6d (patch)
treea55ca353bb546967fb56e250e0da469f8d4ea291 /azalea-client/src/player.rs
parent5643cc4a9450d000a3cc7bc771409313cdfbf5b4 (diff)
downloadazalea-drasl-b030b0ea330c674415f7e30634957167b2fa6a6d.tar.xz
start adding moving
Diffstat (limited to 'azalea-client/src/player.rs')
-rw-r--r--azalea-client/src/player.rs24
1 files changed, 22 insertions, 2 deletions
diff --git a/azalea-client/src/player.rs b/azalea-client/src/player.rs
index 9a5ba8ab..ee0b9718 100644
--- a/azalea-client/src/player.rs
+++ b/azalea-client/src/player.rs
@@ -1,7 +1,27 @@
use azalea_entity::Entity;
+use azalea_world::World;
+use uuid::Uuid;
#[derive(Default, Debug)]
pub struct Player {
- /// The entity attached to the player. There's some useful fields here.
- pub entity: Entity,
+ /// The player's uuid.
+ pub uuid: Uuid,
+ /// The player's entity id.
+ pub entity_id: u32,
+}
+
+impl Player {
+ /// Get the entity of the player in the world.
+ pub fn entity<'a>(&self, world: &'a World) -> Option<&'a Entity> {
+ // world.entity_by_uuid(&self.uuid)
+ world.entity_by_id(self.entity_id)
+ }
+
+ pub fn set_uuid(&mut self, uuid: Uuid) {
+ self.uuid = uuid;
+ }
+
+ pub fn set_entity_id(&mut self, entity_id: u32) {
+ self.entity_id = entity_id;
+ }
}