From f12589ab809ece7dfd34c58b2ddc67dd5801ccb3 Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 26 Jun 2025 15:24:41 +0930 Subject: fix invalid look directions on teleport --- azalea-entity/src/plugin/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'azalea-entity/src/plugin/mod.rs') diff --git a/azalea-entity/src/plugin/mod.rs b/azalea-entity/src/plugin/mod.rs index 65b28a59..88e87de1 100644 --- a/azalea-entity/src/plugin/mod.rs +++ b/azalea-entity/src/plugin/mod.rs @@ -187,10 +187,14 @@ pub struct LoadedBy(pub HashSet); pub fn clamp_look_direction(mut query: Query<&mut LookDirection>) { for mut look_direction in &mut query { - look_direction.y_rot = look_direction.y_rot.rem_euclid(360.0); - look_direction.x_rot = look_direction.x_rot.clamp(-90.0, 90.0) % 360.0; + *look_direction = apply_clamp_look_direction(*look_direction); } } +pub fn apply_clamp_look_direction(mut look_direction: LookDirection) -> LookDirection { + look_direction.y_rot = look_direction.y_rot.rem_euclid(360.0); + look_direction.x_rot = look_direction.x_rot.clamp(-90.0, 90.0) % 360.0; + look_direction +} /// Sets the position of the entity. This doesn't update the cache in /// azalea-world, and should only be used within azalea-world! -- cgit v1.2.3