[PR #2748] [MERGED] Pin the turtle's walk animation to vanilla's rate (fixes #1776) #4583

Closed
opened 2026-11-03 04:18:14 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2748
Author: @levzzz5154
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @ludovic111

Base: main ← Head: fix/turtle-walk-animation-rate


📝 Commits (1)

  • 186198a Pin the turtle's walk animation to vanilla's rate

📊 Changes

1 file changed (+41 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/mobs/turtle.rs (+41 -0)

📄 Description

🤖 Opened by levzzz5154's AI agent (Claude Code), not by levzzz5154 himself.

What and why

The turtle's "erratic feet" (#1776) were the walk animation running at its maximum. LivingEntity.updateWalkAnimation turns the distance a tick into min(distance * 4, 1), and TurtleModel.setupAnim swings the legs by 8 * walkAnimationSpeed, so the animation runs at the rate of the walk. The turtle used the generic MoveControl, which walked it at its full movement speed (0.25): 0.55066 blocks a tick, so the target saturated at 1.0 and the legs swung at the maximum rate and amplitude.

PR #2565 (merged as b16ab9e8c) gave the turtle its own TurtleMoveControl, so the turtle walks at vanilla's pace — but its tests only pin the forward input the control sets, not the rate of the animation the reporter actually saw. This pull request is test-only: it pins the symptom itself.

The new test in crates/horizon-client/src/mobs/turtle.rs drives the turtle's own control, Mob::move_relative and Mob::update_walk_animation over the vanilla's ground movement (the friction 0.6 times the air drag 0.91) and asserts the two numbers vanilla produces: 0.18447 blocks a tick and a walk animation speed of 0.73789 (min(0.18447 * 4, 1)), where the old generic control gave 0.55066 and a saturated 1.0.

Fixes #1776

Vanilla reference

  • net.minecraft.world.entity.animal.turtle.Turtle$TurtleMoveControl.updateSpeed / .tick — the halved speed with the 0.06 floor, then Mth.lerp(0.125F, getSpeed(), speedModifier * MOVEMENT_SPEED) towards the turtle's 0.25 movement speed, which settles the forward input at 0.08375 on land.
  • net.minecraft.world.entity.LivingEntity.getFrictionInfluencedSpeed / .getSpeed — on grass (friction 0.6) the movement speed is the forward input, unchanged.
  • net.minecraft.world.entity.Entity.moveRelative / .getInputVector — the input, rotated by the yaw, scaled by that speed and added to the motion.
  • net.minecraft.world.entity.LivingEntity.travelInAir — after the move the motion is scaled by the friction (0.6) times the air drag (0.91) = 0.546, so the steady state is 0.08375 / (1 - 0.546) = 0.18447 blocks a tick.
  • net.minecraft.world.entity.LivingEntity.calculateEntityAnimation / .updateWalkAnimation — min(distance * 4.0F, 1.0F), smoothed by 0.4 into walkAnimationSpeed.
  • net.minecraft.client.model.animal.turtle.TurtleModel.setupAnim — on land the front legs swing by 8.0F * walkAnimationSpeed and the hind ones by 3.0F * walkAnimationSpeed.

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on cachyos-x8664, against upstream/main at 6817cb4af, 4 min 19 s)

Check Result
Scope ✅ 1 files, +41 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 331 passed (17 s)
rustfmt ✅ (4 s)
clippy ✅ (1 min 10 s)
tests: horizon-client ✅ 1316 passed (2 min 5 s)
doc tests ✅ 0 passed (31 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 62 affected, to run in CI (--quick): arrow, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, breaking_model, cauldron, command_exec, creative, cursor_death, entity_components and 50 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)
  • cargo test --locked -p horizon-client --lib -- turtle → 6 passed; 0 failed (the five from #2565 plus the new one).
  • Negative control: with the turtle's control reverted to the generic MoveControl's pace (setSpeed(wanted) instead of Mth.lerp(0.125F, ...)) the new test fails: assertion failed: (distance - 0.083_75 / (1.0 - 0.546)).abs() < 1.0e-6.
  • python3 tools/test_entity_model_parity.py --filter turtle → 74 cases compared over 2 layers … entity model parity ok.
  • cargo fmt -p horizon-client → no changes.
  • The branch is based on the current upstream/main (6817cb4af), which already carries 07e935d0b "Mobs: drop the unreachable second rabbit arm in mob_to_nbt". The earlier base still had the duplicate "minecraft:rabbit" => arm in crates/horizon-client/src/entity_nbt.rs, which made clippy -- -D warnings fail with unreachable_patterns and had upstream's own checks job red (runs 40476007743, 40475101761, 40475094181, all "failure"). With the current base that arm is gone, so this branch needs no extra change for it and the build is clean.

🤖 Generated with Claude Code.


🔄 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/2748 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/turtle-walk-animation-rate` --- ### 📝 Commits (1) - [`186198a`](https://github.com/horizon-rust/horizon/commit/186198afe6fa6747694aecfa33d2a53fd3781269) Pin the turtle's walk animation to vanilla's rate ### 📊 Changes **1 file changed** (+41 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/turtle.rs` (+41 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code), not by levzzz5154 himself. ## What and why The turtle's "erratic feet" (#1776) were the walk animation running at its maximum. `LivingEntity.updateWalkAnimation` turns the distance a tick into `min(distance * 4, 1)`, and `TurtleModel.setupAnim` swings the legs by `8 * walkAnimationSpeed`, so the animation runs at the rate of the walk. The turtle used the generic `MoveControl`, which walked it at its full movement speed (0.25): 0.55066 blocks a tick, so the target saturated at 1.0 and the legs swung at the maximum rate and amplitude. PR #2565 (merged as `b16ab9e8c`) gave the turtle its own `TurtleMoveControl`, so the turtle walks at vanilla's pace — but its tests only pin the *forward input* the control sets, not the rate of the animation the reporter actually saw. This pull request is test-only: it pins the symptom itself. The new test in `crates/horizon-client/src/mobs/turtle.rs` drives the turtle's own control, `Mob::move_relative` and `Mob::update_walk_animation` over the vanilla's ground movement (the friction 0.6 times the air drag 0.91) and asserts the two numbers vanilla produces: **0.18447 blocks a tick** and a **walk animation speed of 0.73789** (`min(0.18447 * 4, 1)`), where the old generic control gave 0.55066 and a saturated 1.0. Fixes #1776 ## Vanilla reference - `net.minecraft.world.entity.animal.turtle.Turtle$TurtleMoveControl.updateSpeed` / `.tick` — the halved speed with the 0.06 floor, then `Mth.lerp(0.125F, getSpeed(), speedModifier * MOVEMENT_SPEED)` towards the turtle's 0.25 movement speed, which settles the forward input at 0.08375 on land. - `net.minecraft.world.entity.LivingEntity.getFrictionInfluencedSpeed` / `.getSpeed` — on grass (friction 0.6) the movement speed is the forward input, unchanged. - `net.minecraft.world.entity.Entity.moveRelative` / `.getInputVector` — the input, rotated by the yaw, scaled by that speed and added to the motion. - `net.minecraft.world.entity.LivingEntity.travelInAir` — after the move the motion is scaled by the friction (0.6) times the air drag (0.91) = 0.546, so the steady state is 0.08375 / (1 - 0.546) = 0.18447 blocks a tick. - `net.minecraft.world.entity.LivingEntity.calculateEntityAnimation` / `.updateWalkAnimation` — `min(distance * 4.0F, 1.0F)`, smoothed by 0.4 into `walkAnimationSpeed`. - `net.minecraft.client.model.animal.turtle.TurtleModel.setupAnim` — on land the front legs swing by `8.0F * walkAnimationSpeed` and the hind ones by `3.0F * walkAnimationSpeed`. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on cachyos-x8664, against upstream/main at 6817cb4af, 4 min 19 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +41 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 331 passed (17 s) | | rustfmt | ✅ (4 s) | | clippy | ✅ (1 min 10 s) | | tests: horizon-client | ✅ 1316 passed (2 min 5 s) | | doc tests | ✅ 0 passed (31 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 62 affected, to run in CI (--quick): arrow, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, breaking_model, cauldron, command_exec, creative, cursor_death, entity_components and 50 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | - `cargo test --locked -p horizon-client --lib -- turtle` → `6 passed; 0 failed` (the five from #2565 plus the new one). - Negative control: with the turtle's control reverted to the generic `MoveControl`'s pace (`setSpeed(wanted)` instead of `Mth.lerp(0.125F, ...)`) the new test fails: `assertion failed: (distance - 0.083_75 / (1.0 - 0.546)).abs() < 1.0e-6`. - `python3 tools/test_entity_model_parity.py --filter turtle` → `74 cases compared over 2 layers` … `entity model parity ok`. - `cargo fmt -p horizon-client` → no changes. - The branch is based on the current `upstream/main` (`6817cb4af`), which already carries `07e935d0b` "Mobs: drop the unreachable second rabbit arm in mob_to_nbt". The earlier base still had the duplicate `"minecraft:rabbit" =>` arm in `crates/horizon-client/src/entity_nbt.rs`, which made `clippy -- -D warnings` fail with `unreachable_patterns` and had upstream's own `checks` job red (runs `40476007743`, `40475101761`, `40475094181`, all "failure"). With the current base that arm is gone, so this branch needs no extra change for it and the build is clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:18:14 +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#4583
No description provided.