diff --git a/crates/horizon-client/src/entities.rs b/crates/horizon-client/src/entities.rs index 69e053411..3a23a6c32 100644 --- a/crates/horizon-client/src/entities.rs +++ b/crates/horizon-client/src/entities.rs @@ -713,6 +713,17 @@ pub struct ArmorStand { } impl ArmorStand { pub const SLOTS: [&'static str; 6] = ["mainhand", "offhand", "feet", "legs", "chest", "head"]; + /// The eye height of `getDimensionsMarker`: none for a marker, halved + /// (with `BABY_DIMENSIONS`' 0.9875) when small. + pub fn eye_height(&self) -> f64 { + if self.marker { + 0.0 + } else if self.small { + f64::from(0.9875f32) + } else { + f64::from(1.7775f32) + } + } pub fn new(id: u32, position: Vec3, yaw: f32) -> Self { Self { fire_ticks: 0, diff --git a/crates/horizon-client/src/game/commands/execute.rs b/crates/horizon-client/src/game/commands/execute.rs index 3f7e4c2a0..cda51eabb 100644 --- a/crates/horizon-client/src/game/commands/execute.rs +++ b/crates/horizon-client/src/game/commands/execute.rs @@ -145,6 +145,18 @@ impl Game<'_> { .iter() .find(|m| m.id == id) .map_or(0.0, |m| m.eye_y() - m.position.y), + Target::Stand(id) => self + .armor_stands + .iter() + .find(|a| a.id == id) + .map_or(0.0, |a| a.eye_height()), + // EntityType eyeHeight: boats 0.5625, items 0.2125; the rest keep + // the default of 0.85 of the height (minecarts 0.7, experience + // orbs and paintings 0.5), item frames 0. + Target::Boat(_) => f64::from(0.5625f32), + Target::Item(_) => f64::from(0.2125f32), + Target::Cart(_) => f64::from(0.7f32 * 0.85), + Target::Orb(_) | Target::Painting(_) => f64::from(0.5f32 * 0.85), _ => 0.0, } }