[PR #7015] [MERGED] A goat's head stays within fifteen degrees of its body #7274

Closed
opened 2026-11-03 06:36:52 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7015
Author: @MSedgeMC
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: fix/goat-head-yaw2


📝 Commits (3)

  • 38b4f47 A goat's head stays within fifteen degrees of its body
  • 60d6008 Import Vec3 in the goat head test module
  • 38b701f Goat head test: horizon_core's Vec3 and the goat's 15-degree head limit

📊 Changes

2 files changed (+51 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/mobs/control.rs (+50 -0)
📝 tools/port_map/game-012.tsv (+1 -1)

📄 Description

Vanilla's Goat.setYHeadRot wraps the body rotation by Mth.clamp(Mth.degreesDifference(yBodyRot, yHeadRot), -getMaxHeadYRot(), getMaxHeadYRot()) with getMaxHeadYRot() 15, so every head rotation a goat is given stays within 15 degrees of its body, standing still or walking.

Horizon applied the 15 degree limit in mobs/control.rs::look_control_tick only while !self.ai.nav.is_done(), so a goat that stood still and looked around turned its head as far as the look control could (head_rot_speed per tick) instead of stopping at the body's 15 degrees.

Proven: rustfmt --edition 2024 --check passes on crates/horizon-client/src/mobs/control.rs; the vanilla clamp is javap -p -c net.minecraft.world.entity.animal.goat.Goat -> setYHeadRot (getMaxHeadYRot, Mth.degreesDifference, Mth.clamp, then Animal.setYHeadRot(yBodyRot + clamped)), which is exactly control.rs::rotate_if_necessary(head_yaw, body_yaw, max).

Not proven: no build or test run yet: the build VM is in cooldown (suspended until 10:55Z), so the new mobs::control::goat_head_tests::a_goats_head_stays_within_fifteen_degrees_of_its_body and cargo clippy have not been run here and CI is the authority for both; I will run them on the VM as soon as it is back and report the result here. The in-game check is a goat standing still and turning its head: it should stop at 15 degrees from its body, where before it turned most of the way round.

Corrects the Goat.setYHeadRot row of tools/port_map/game-012.tsv.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/7015 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/goat-head-yaw2` --- ### 📝 Commits (3) - [`38b4f47`](https://github.com/horizon-rust/horizon/commit/38b4f4735e6f42af2218af791db544cc61753412) A goat's head stays within fifteen degrees of its body - [`60d6008`](https://github.com/horizon-rust/horizon/commit/60d6008a7b6818da61d4f9c4dc6fefaaf8ef9b83) Import Vec3 in the goat head test module - [`38b701f`](https://github.com/horizon-rust/horizon/commit/38b701feb00e18ca3ec46898d632fe687d2f2ce7) Goat head test: horizon_core's Vec3 and the goat's 15-degree head limit ### 📊 Changes **2 files changed** (+51 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/control.rs` (+50 -0) 📝 `tools/port_map/game-012.tsv` (+1 -1) </details> ### 📄 Description Vanilla's `Goat.setYHeadRot` wraps the body rotation by `Mth.clamp(Mth.degreesDifference(yBodyRot, yHeadRot), -getMaxHeadYRot(), getMaxHeadYRot())` with `getMaxHeadYRot()` 15, so every head rotation a goat is given stays within 15 degrees of its body, standing still or walking. Horizon applied the 15 degree limit in `mobs/control.rs::look_control_tick` only while `!self.ai.nav.is_done()`, so a goat that stood still and looked around turned its head as far as the look control could (`head_rot_speed` per tick) instead of stopping at the body's 15 degrees. **Proven:** `rustfmt --edition 2024 --check` passes on `crates/horizon-client/src/mobs/control.rs`; the vanilla clamp is `javap -p -c net.minecraft.world.entity.animal.goat.Goat` -> `setYHeadRot` (`getMaxHeadYRot`, `Mth.degreesDifference`, `Mth.clamp`, then `Animal.setYHeadRot(yBodyRot + clamped)`), which is exactly `control.rs::rotate_if_necessary(head_yaw, body_yaw, max)`. **Not proven:** no build or test run yet: the build VM is in cooldown (suspended until 10:55Z), so the new `mobs::control::goat_head_tests::a_goats_head_stays_within_fifteen_degrees_of_its_body` and `cargo clippy` have not been run here and CI is the authority for both; I will run them on the VM as soon as it is back and report the result here. The in-game check is a goat standing still and turning its head: it should stop at 15 degrees from its body, where before it turned most of the way round. Corrects the `Goat.setYHeadRot` row of `tools/port_map/game-012.tsv`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:36:52 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#7274
No description provided.