diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2022-11-18 22:11:30 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-18 22:11:30 -0600 |
| commit | befa22c1f3ff0c1f0cb745b3f4e736910c053a8b (patch) | |
| tree | 17037d0d62d1259366d9385c47236774886b4002 /azalea-client/src/movement.rs | |
| parent | 6c6eb5572b869e3199adc560b101fa663c01b5d2 (diff) | |
| download | azalea-drasl-befa22c1f3ff0c1f0cb745b3f4e736910c053a8b.tar.xz | |
Player List (#41)
* keep track of player list
* send player update events
Diffstat (limited to 'azalea-client/src/movement.rs')
| -rwxr-xr-x | azalea-client/src/movement.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/azalea-client/src/movement.rs b/azalea-client/src/movement.rs index d33b4b4a..87ac8d85 100755 --- a/azalea-client/src/movement.rs +++ b/azalea-client/src/movement.rs @@ -153,20 +153,20 @@ impl Client { // Set our current position to the provided Vec3, potentially clipping through blocks. pub async fn set_pos(&mut self, new_pos: Vec3) -> Result<(), MovePlayerError> { - let player_lock = self.player.write(); + let player_entity_id = *self.entity_id.read(); let mut world_lock = self.world.write(); - world_lock.set_entity_pos(player_lock.entity_id, new_pos)?; + world_lock.set_entity_pos(player_entity_id, new_pos)?; Ok(()) } pub async fn move_entity(&mut self, movement: &Vec3) -> Result<(), MovePlayerError> { let mut world_lock = self.world.write(); - let player = self.player.write(); + let player_entity_id = *self.entity_id.read(); - let mut entity = player - .entity_mut(&mut world_lock) + let mut entity = world_lock + .entity_mut(player_entity_id) .ok_or(MovePlayerError::PlayerNotInWorld)?; log::trace!( "move entity bounding box: {} {:?}", |
