diff options
Diffstat (limited to 'azalea-client/src/plugins')
| -rw-r--r-- | azalea-client/src/plugins/interact/mod.rs | 4 | ||||
| -rw-r--r-- | azalea-client/src/plugins/movement.rs | 14 | ||||
| -rw-r--r-- | azalea-client/src/plugins/packet/game/mod.rs | 16 |
3 files changed, 17 insertions, 17 deletions
diff --git a/azalea-client/src/plugins/interact/mod.rs b/azalea-client/src/plugins/interact/mod.rs index f02c05d5..634d492c 100644 --- a/azalea-client/src/plugins/interact/mod.rs +++ b/azalea-client/src/plugins/interact/mod.rs @@ -297,8 +297,8 @@ pub fn handle_start_use_item_queued( ServerboundUseItem { hand: start_use_item.hand, seq, - x_rot: look_direction.x_rot, - y_rot: look_direction.y_rot, + x_rot: look_direction.x_rot(), + y_rot: look_direction.y_rot(), }, )); } else { diff --git a/azalea-client/src/plugins/movement.rs b/azalea-client/src/plugins/movement.rs index aeb946fa..c27a67ce 100644 --- a/azalea-client/src/plugins/movement.rs +++ b/azalea-client/src/plugins/movement.rs @@ -105,15 +105,15 @@ impl Client { let mut ecs = self.ecs.lock(); let mut look_direction = self.query::<&mut LookDirection>(&mut ecs); - (look_direction.y_rot, look_direction.x_rot) = (y_rot, x_rot); + look_direction.update(LookDirection::new(y_rot, x_rot)); } /// Returns the direction the client is looking. The first value is the y /// rotation (ie. yaw, looking to the side) and the second value is the x /// rotation (ie. pitch, looking up and down). pub fn direction(&self) -> (f32, f32) { - let look_direction = self.component::<LookDirection>(); - (look_direction.y_rot, look_direction.x_rot) + let look_direction: LookDirection = self.component::<LookDirection>(); + (look_direction.y_rot(), look_direction.x_rot()) } } @@ -176,8 +176,8 @@ pub fn send_position( let x_delta = position.x - last_sent_position.x; let y_delta = position.y - last_sent_position.y; let z_delta = position.z - last_sent_position.z; - let y_rot_delta = (direction.y_rot - last_direction.y_rot) as f64; - let x_rot_delta = (direction.x_rot - last_direction.x_rot) as f64; + let y_rot_delta = (direction.y_rot() - last_direction.y_rot) as f64; + let x_rot_delta = (direction.x_rot() - last_direction.x_rot) as f64; physics_state.position_remainder += 1; @@ -231,8 +231,8 @@ pub fn send_position( physics_state.position_remainder = 0; } if sending_direction { - last_direction.y_rot = direction.y_rot; - last_direction.x_rot = direction.x_rot; + last_direction.y_rot = direction.y_rot(); + last_direction.x_rot = direction.x_rot(); } let on_ground = physics.on_ground(); diff --git a/azalea-client/src/plugins/packet/game/mod.rs b/azalea-client/src/plugins/packet/game/mod.rs index 1fa3e109..fe294ad0 100644 --- a/azalea-client/src/plugins/packet/game/mod.rs +++ b/azalea-client/src/plugins/packet/game/mod.rs @@ -900,10 +900,10 @@ impl GamePacketHandler<'_> { }; let new_delta = p.delta.clone(); - let new_look_direction = LookDirection { - x_rot: (p.x_rot as i32 * 360) as f32 / 256., - y_rot: (p.y_rot as i32 * 360) as f32 / 256., - }; + let new_look_direction = LookDirection::new( + (p.y_rot as i32 * 360) as f32 / 256., + (p.x_rot as i32 * 360) as f32 / 256., + ); let new_on_ground = p.on_ground; @@ -938,10 +938,10 @@ impl GamePacketHandler<'_> { let entity = entity_id_index.get_by_minecraft_entity(p.entity_id); if let Some(entity) = entity { - let new_look_direction = LookDirection { - x_rot: (p.x_rot as i32 * 360) as f32 / 256., - y_rot: (p.y_rot as i32 * 360) as f32 / 256., - }; + let new_look_direction = LookDirection::new( + (p.y_rot as i32 * 360) as f32 / 256., + (p.x_rot as i32 * 360) as f32 / 256., + ); let new_on_ground = p.on_ground; commands.entity(entity).queue(RelativeEntityUpdate::new( |
