diff options
| author | mat <github@matdoes.dev> | 2022-12-08 18:39:35 -0600 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-12-08 18:39:35 -0600 |
| commit | 70e2dfed16da8d5130460ea15b47701e622f4a9f (patch) | |
| tree | 41f670baf3a05ed180880ec2a11d8e5f6a1a1599 /azalea-client | |
| parent | f2076daba5cfcce81399b075ba9258fbdc2012fa (diff) | |
| download | azalea-drasl-70e2dfed16da8d5130460ea15b47701e622f4a9f.tar.xz | |
wrap_comments = true
Diffstat (limited to 'azalea-client')
| -rwxr-xr-x | azalea-client/src/account.rs | 3 | ||||
| -rw-r--r-- | azalea-client/src/client.rs | 18 | ||||
| -rw-r--r-- | azalea-client/src/movement.rs | 16 |
3 files changed, 23 insertions, 14 deletions
diff --git a/azalea-client/src/account.rs b/azalea-client/src/account.rs index 0d758507..d1c20cc8 100755 --- a/azalea-client/src/account.rs +++ b/azalea-client/src/account.rs @@ -104,7 +104,8 @@ impl Account { AuthOpts::Microsoft { email } => { let new_account = Account::microsoft(email).await?; let access_token = self - .access_token.as_ref() + .access_token + .as_ref() .expect("Access token should always be set for Microsoft accounts"); let new_access_token = new_account .access_token diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index 4f0a2ed6..3aad96c4 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -112,7 +112,8 @@ pub struct Client { #[derive(Default)] pub struct PhysicsState { - /// Minecraft only sends a movement packet either after 20 ticks or if the player moved enough. This is that tick counter. + /// Minecraft only sends a movement packet either after 20 ticks or if the + /// player moved enough. This is that tick counter. pub position_remainder: u32, pub was_sprinting: bool, // Whether we're going to try to start sprinting this tick. Equivalent to @@ -383,8 +384,8 @@ impl Client { /// Start the protocol and game tick loop. #[doc(hidden)] pub fn start_tasks(&self, tx: Sender<Event>) { - // if you get an error right here that means you're doing something with locks wrong - // read the error to see where the issue is + // if you get an error right here that means you're doing something with locks + // wrong 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 let mut tasks = self.tasks.lock(); @@ -789,7 +790,8 @@ impl Client { if let Some(mut entity) = world.entity_mut(p.id) { entity.apply_metadata(&p.packed_items.0); } else { - // warn!("Server sent an entity data packet for an entity id ({}) that we don't know about", p.id); + // warn!("Server sent an entity data packet for an entity id + // ({}) that we don't know about", p.id); } } ClientboundGamePacket::UpdateAttributes(_p) => { @@ -1041,7 +1043,8 @@ impl Client { /// of the client's world. /// /// # Panics - /// Panics if the client has not received the login packet yet. You can check this with [`Client::logged_in`]. + /// Panics if the client has not received the login packet yet. You can + /// check this with [`Client::logged_in`]. pub fn world(&self) -> Arc<WeakWorld> { let world_name = self.world_name.read(); let world_name = world_name @@ -1086,8 +1089,9 @@ impl Client { self.world_name.read().is_some() } - /// Tell the server we changed our game options (i.e. render distance, main hand). - /// If this is not set before the login packet, the default will be sent. + /// Tell the server we changed our game options (i.e. render distance, main + /// hand). If this is not set before the login packet, the default will + /// be sent. /// /// ```rust,no_run /// # use azalea_client::{Client, ClientInformation}; diff --git a/azalea-client/src/movement.rs b/azalea-client/src/movement.rs index 5fca924b..5a638883 100644 --- a/azalea-client/src/movement.rs +++ b/azalea-client/src/movement.rs @@ -37,8 +37,8 @@ impl Client { pub(crate) async fn send_position(&mut self) -> Result<(), MovePlayerError> { let packet = { self.send_sprinting_if_needed().await?; - // TODO: the camera being able to be controlled by other entities isn't implemented yet - // if !self.is_controlled_camera() { return }; + // TODO: the camera being able to be controlled by other entities isn't + // implemented yet if !self.is_controlled_camera() { return }; let mut physics_state = self.physics_state.lock(); @@ -54,7 +54,8 @@ impl Client { physics_state.position_remainder += 1; - // boolean sendingPosition = Mth.lengthSquared(xDelta, yDelta, zDelta) > Mth.square(2.0E-4D) || this.positionReminder >= 20; + // boolean sendingPosition = Mth.lengthSquared(xDelta, yDelta, zDelta) > + // Mth.square(2.0E-4D) || this.positionReminder >= 20; let sending_position = ((x_delta.powi(2) + y_delta.powi(2) + z_delta.powi(2)) > 2.0e-4f64.powi(2)) || physics_state.position_remainder >= 20; @@ -155,7 +156,8 @@ impl Client { Ok(()) } - // Set our current position to the provided Vec3, potentially clipping through blocks. + // Set our current position to the provided Vec3, potentially clipping through + // blocks. pub async fn set_position(&mut self, new_pos: Vec3) -> Result<(), MovePlayerError> { let player_entity_id = *self.entity_id.read(); let mut world_lock = self.world.write(); @@ -198,7 +200,8 @@ impl Client { } // TODO: food data and abilities - // let has_enough_food_to_sprint = self.food_data().food_level || self.abilities().may_fly; + // let has_enough_food_to_sprint = self.food_data().food_level || + // self.abilities().may_fly; let has_enough_food_to_sprint = true; // TODO: double tapping w to sprint i think @@ -223,7 +226,8 @@ impl Client { player_entity.ai_step(); } - /// Update the impulse from self.move_direction. The multipler is used for sneaking. + /// Update the impulse from self.move_direction. The multipler is used for + /// sneaking. pub(crate) fn tick_controls(&mut self, multiplier: Option<f32>) { let mut physics_state = self.physics_state.lock(); |
