aboutsummaryrefslogtreecommitdiff
path: root/azalea-client
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-client')
-rw-r--r--azalea-client/src/client.rs6
-rw-r--r--azalea-client/src/movement.rs22
2 files changed, 14 insertions, 14 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs
index 9b3f7cdf..e2967a10 100644
--- a/azalea-client/src/client.rs
+++ b/azalea-client/src/client.rs
@@ -155,8 +155,8 @@ impl Client {
// we got the GameConnection, so the server is now connected :)
let client = Client {
- game_profile: game_profile.clone(),
- conn: conn.clone(),
+ game_profile,
+ conn,
player: Arc::new(Mutex::new(Player::default())),
dimension: Arc::new(Mutex::new(None)),
};
@@ -167,7 +167,7 @@ impl Client {
// read the error to see where the issue is
// you might be able to just drop the lock or put it in its own scope to fix
tokio::spawn(Self::protocol_loop(client.clone(), tx.clone()));
- tokio::spawn(Self::game_tick_loop(client.clone(), tx.clone()));
+ tokio::spawn(Self::game_tick_loop(client.clone(), tx));
Ok((client, rx))
}
diff --git a/azalea-client/src/movement.rs b/azalea-client/src/movement.rs
index 5247e0f0..4f99984f 100644
--- a/azalea-client/src/movement.rs
+++ b/azalea-client/src/movement.rs
@@ -5,20 +5,20 @@ use azalea_protocol::packets::game::serverbound_move_player_packet_pos_rot::Serv
impl Client {
/// Set the client's position to the given coordinates.
pub async fn move_to(&mut self, new_pos: EntityPos) -> Result<(), String> {
- let mut dimension_lock = self.dimension.lock().unwrap();
- let dimension = dimension_lock.as_mut().unwrap();
+ {
+ let mut dimension_lock = self.dimension.lock().unwrap();
+ let dimension = dimension_lock.as_mut().unwrap();
- let player_lock = self.player.lock().unwrap();
+ let player_lock = self.player.lock().unwrap();
- let player_id = if let Some(player_lock) = player_lock.entity(dimension) {
- player_lock.id
- } else {
- return Err("Player entity not found".to_string());
- };
+ let player_id = if let Some(player_lock) = player_lock.entity(dimension) {
+ player_lock.id
+ } else {
+ return Err("Player entity not found".to_string());
+ };
- dimension.move_entity(player_id, new_pos)?;
- drop(dimension_lock);
- drop(player_lock);
+ dimension.move_entity(player_id, new_pos)?;
+ }
self.conn
.lock()