[PR #5445] [MERGED] Armor stands: draw them between ticks, turn and snap like living entities #6294

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5445
Author: @navinor
Created: 10/31/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/armor-stand-lerp


📝 Commits (7)

  • ccc34ef Draw armor stands between ticks, so a falling one moves smoothly
  • 34ff18c Armor stands turn between ticks and snap on far moves, as living entities
  • 7bb5aec Measure a far teleport from where the entity is headed
  • 642ed5b A stand riding the player is seated after the player's move
  • ae2088d Merge remote-tracking branch 'origin/main' into fix/armor-stand-lerp
  • 1c6d693 lan_e2e objects: a stand that falls, so the guest follows its moves
  • 6f941a5 Merge branch 'main' into fix/armor-stand-lerp

📊 Changes

9 files changed (+353 additions, -76 deletions)

View changed files

📝 crates/horizon-client/src/entities.rs (+88 -0)
📝 crates/horizon-client/src/game.rs (+5 -4)
📝 crates/horizon-client/src/game/armor_stands.rs (+13 -8)
📝 crates/horizon-client/src/game/debug_keys.rs (+7 -2)
📝 crates/horizon-client/src/game/names.rs (+6 -4)
📝 crates/horizon-client/src/game/passengers.rs (+42 -18)
📝 crates/horizon-client/src/game/remote.rs (+186 -31)
📝 crates/horizon-client/src/game/remote_objects.rs (+4 -9)
📝 tools/lan_e2e.py (+2 -0)

📄 Description

🤖 Opened by navinor's AI agent (OpenCode, Claude Opus 5.5), not by navinor personally.

What and why

Fixes #4416: a falling armor stand moved in steps instead of sliding down like it does in vanilla.

Vanilla's EntityRenderer draws every entity at Mth.lerp(partialTick, xo, x) (and yo, zo), and ClientLevel.tickNonPassenger saves xo through setOldPosAndRot before each tick. Horizon's boats, TNT, tridents and mobs already keep a previous position for that. Armor stands didn't: armor_stand_geometry placed the model at a.position and passed that same point as both ends of the culling box. So on a server's client (the server thread included) a falling stand moved once a tick, while the frames in between drew it in the same place.

This PR:

  • adds ArmorStand::previous (the spawn position in ArmorStand::new), ArmorStand::render_position(alpha), and ArmorStand::interpolate(step), which saves previous and then takes the interpolation step. The client tick calls it for each stand;
  • seats a stand riding a mob or the player at both ends. On a mob, previous comes from the vehicle's previous seat, as position_riders already does for mob riders (commonTick runs before rideTick). On the local player, seat_own_stands runs after the player's move, from the previous_position just saved to the moved position, since vanilla ticks the player (tickNonPassenger) before its passengers (positionRider). So a name hologram on the player is drawn between the same two points as the player, with no tick of lag;
  • saves previous at the start of the in-frame tick_armor_stands. That path is deprecated; without the line it would draw stands between their spawn point and where they are now;
  • draws the body, its light, the culling box, the name tag, the flames and the F3+B hitbox at the blended position.

The second and third commits treat stands as the living entities they are in vanilla:

  • An armor stand is a LivingEntity, so a vanilla client moves it with the SteppedInterpolationHandler over its update interval (3), position and yaw together. ArmorStand.tickHeadTurn makes the body follow yRot. Horizon eased stands with the generic three-step lerp used for boats and set their yaw at once from each packet. Stands now go through the mobs' SteppedInterpolation handler (move_entity, stepped in tick_remote_entities), and ArmorStand::interpolate keeps the yaw continuous and saves yBodyRotO. The renderer and the F3+B hitbox turn the body by Mth.rotLerp(partialTick, yBodyRotO, yBodyRot) (ArmorStand::render_yaw). The mob and stand branches of move_entity share stepped_move.
  • A move of more than 64 blocks snaps (tooBigToInterpolate), with nothing left to blend from (Entity.snapTo, ArmorStand::snap).
    • TeleportEntity now snaps too, as setValuesFromPositionPacket does. Before, only EntityPositionSync did, so a far-teleported mob also slid there over three ticks.
    • The two packets measure the distance differently. A teleport goes from PositionMoveRotation.of(entity), which is getClientPositionAndRotation(): the interpolation target while one runs. A position sync goes from the entity's position. MovePacket::snaps keeps them apart.
    • A snapped mob now resets its previous yaw and pitch as well as its position (setOldPosAndRot), so it doesn't spin for a frame.
  • Every spawn starts with a fresh interpolation handler, a stand's included, even under an id the server used before.

Not in this PR:

  • After a far snap, vanilla keeps the handler running, and its next step shifts the remaining steps by the jump (adjustInterpolationTargetFromDeltas, collision-checked). Horizon's handler doesn't port that, so the steps are dropped, as they already were for mobs. For an entity that wasn't moving the result is the same.
  • TeleportEntity's relative flags (position and rotation) are still resolved against the last position the server sent. Vanilla's server sends relative teleports only to the player controlling the vehicle (Entity.sendTeleportTransitionToPlayers), and Horizon handles that mount on its own path.
  • A stand riding a living entity still turns its body by its own yaw, not by its vehicle's (solveBodyRot's riding branch).
  • Boats and minecarts on the generic lerps still slide on a far teleport.

Kind

  • parity: Horizon now does what vanilla 26.3 does

Vanilla reference

net.minecraft.client.renderer.entity.EntityRenderer (the Mth.lerp(partialTick, entity.xo, entity.getX()) render position and getBoundingBoxForCulling(entity, partialTicks)), net.minecraft.client.multiplayer.ClientLevel.tickNonPassenger / tickPassenger (setOldPosAndRot before tick / rideTick), LivingEntityRenderer.solveBodyRot, ArmorStand.tickHeadTurn, LivingEntity.createInterpolationHandler, ClientPacketListener.handleEntityPositionSync and setValuesFromPositionPacket (tooBigToInterpolate), Entity.snapTo.

What checks it:

  • entities::armor_stand_render_tests:
    • a_falling_stand_is_drawn_between_its_ticks runs a stand through interpolate as the client tick does. It draws at its spawn point when new, at 70, 69.75 and 69 for partial ticks 0, 0.25 and 1 after a 1-block step, halfway through the next step, and stays put once no step is due.
    • a_turning_stand_is_drawn_between_its_ticks: from 170° to -170° the body passes through 180°, the short way.
    • a_snapped_stand_is_drawn_where_it_landed: after a snap, every frame draws it at the new place and yaw.
  • game::remote::tests:
    • a_far_move_snaps_by_the_packets_own_measure: an entity at x 0 headed for x 50 snaps on a position sync to x 100 but not on a teleport there. With nothing in flight, both measure from the entity.
    • a_living_entitys_move_snaps_or_steps: an entity walking toward x 5 gets a far sync and is put there with no step back toward x 5 left (it fails without handler.cancel() in stepped_move). A rotation-only move keeps the position and turns from 90° through 120° and 150° to 180°, one step per tick.
  • tools/lan_e2e.py, server-thread host and a guest, on Windows:
    • objects (pass): now also summons a stand 3 blocks up turned to 200°, so where it lands and its yaw are compared between host and guest, along with the other 15 objects.
    • levels (pass): its ticking step drops a stand in each level and checks the guest's copy lands on the floor. One run before this missed the host's pig (a pig wandering out of the 8-block search; the server-side kill didn't find it either), and the rerun passed every step.
    • frames (pass): the stand's helmet on and off and the turned frame match on both sides.
  • A real game against a vanilla 26.3 server (offline mode), driven with horizon-ctl. I set /tick rate 2 (500 ms ticks; Horizon's client follows it through ClientboundTickingState), summoned a stand 10 blocks up in front of the camera, and took 16 screenshots about 70 ms apart, 3.5 s into the fall. The numbers are the top row of the stand's pixels in each one:
    • main: 51 51 51 51 51 51 51 61 61 61 61 61 61 61 61 82. 13 of 15 frames repeat the one before; the stand jumps 10 to 20 px once a tick.
    • this PR: 50 52 53 54 56 57 59 60 62 63 64 66 67 69 70 71. No frame repeats.
  • The same setup, reading the stand's position and yaw from horizon-ctl status every 250 ms (each tick is 500 ms):
    • /tp the stand to yaw 90: on main the yaw goes from 0 to 90 in one tick. With this PR it goes 0, 30, 60, 90, one step per tick, which is the stepped handler with an interval of 3.
    • /tp the stand 70 blocks east: on main it slides x = -39.5, -16.2, 7.2, 30.5 over three ticks. With this PR it is at 30.5 on the first reading after the packet.

Other projects' code

None.

Self-check

After the review fixes I merged main (f99f8feaa, which has #5299's windows-sys features). On that merge, on Windows: cargo fmt --check and cargo clippy -p horizon-client --lib --bins --tests -- -D warnings pass, and the stand, rider and move tests pass (12). port_ledger.py check --base origin/main no longer lists the Entity.snapTo or ClientLevel.tickNonPassenger gaps. The table below is the earlier run, before the merge.

pr_ready (tools/pr_ready.py --quick on Aaron, against origin/main at b8cf85f8c, 4 min 44 s)

Check Result
Scope ✅ 9 files, +319 −70
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 500 run, FAILED (errors=1, skipped=12) (1 min 1 s)
rustfmt ✅ (8 s)
clippy ❌ failed (3 s)
tests: horizon-client, horizon-threads ❌ 1383 passed, 1 failed (3 min 25 s)
doc tests ✅ 0 passed (3 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 ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

I ran this on Windows, where main at b8cf85f8c doesn't build horizon-threads without the windows-sys features #5299 adds. I applied those locally, which is the 9th file and the horizon-threads in the table; they aren't in this PR. The three ❌ rows fail the same way on b8cf85f8c without this PR:

  • Python: test_perf_bench.test_table_distinguishes_missing_scene_load_from_zero (ValueError: cannot compare RD 8). This PR changes no Python.
  • clippy: clippy::unnecessary_mut_passed in horizon-threads/src/boot_paint.rs:47, the file #5299 touches. cargo clippy -p horizon-client --lib --bins --tests -- -D warnings -A clippy::unnecessary_mut_passed passes.
  • tests: native_hooks::tests::property_setters_refuse_no_change, which searches its own source for \n and finds \r\n in a Windows checkout (core.autocrlf=true).

Outside pr_ready: the lan_bot integration test has 8 of 14 failing, the same 8 on b8cf85f8c (the hub.rs part of #5299). forced_chunks, generation_saves, launch_api, streaming_meshes, tall_column and wide_states pass. Harnesses weren't run here because tools/parity.py needs fcntl.

🤖 Generated with OpenCode


🔄 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/5445 **Author:** [@navinor](https://github.com/navinor) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/armor-stand-lerp` --- ### 📝 Commits (7) - [`ccc34ef`](https://github.com/horizon-rust/horizon/commit/ccc34ef964b5d183208ad67b7473dd7aa9d10cb2) Draw armor stands between ticks, so a falling one moves smoothly - [`34ff18c`](https://github.com/horizon-rust/horizon/commit/34ff18cdada9e8027e59632e08e54cc72afb6250) Armor stands turn between ticks and snap on far moves, as living entities - [`7bb5aec`](https://github.com/horizon-rust/horizon/commit/7bb5aec013213459a790f588932892c78683662e) Measure a far teleport from where the entity is headed - [`642ed5b`](https://github.com/horizon-rust/horizon/commit/642ed5b09b317b58f933c27ad393dcf24cbca484) A stand riding the player is seated after the player's move - [`ae2088d`](https://github.com/horizon-rust/horizon/commit/ae2088d2ab7aea84fa775551610a8290bc2ec379) Merge remote-tracking branch 'origin/main' into fix/armor-stand-lerp - [`1c6d693`](https://github.com/horizon-rust/horizon/commit/1c6d6935d48f6ed625c132e4574d975fdef5d1a3) lan_e2e objects: a stand that falls, so the guest follows its moves - [`6f941a5`](https://github.com/horizon-rust/horizon/commit/6f941a5e92de9b3736313160b1f4bb0d68b6981e) Merge branch 'main' into fix/armor-stand-lerp ### 📊 Changes **9 files changed** (+353 additions, -76 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entities.rs` (+88 -0) 📝 `crates/horizon-client/src/game.rs` (+5 -4) 📝 `crates/horizon-client/src/game/armor_stands.rs` (+13 -8) 📝 `crates/horizon-client/src/game/debug_keys.rs` (+7 -2) 📝 `crates/horizon-client/src/game/names.rs` (+6 -4) 📝 `crates/horizon-client/src/game/passengers.rs` (+42 -18) 📝 `crates/horizon-client/src/game/remote.rs` (+186 -31) 📝 `crates/horizon-client/src/game/remote_objects.rs` (+4 -9) 📝 `tools/lan_e2e.py` (+2 -0) </details> ### 📄 Description > 🤖 Opened by navinor's AI agent (OpenCode, Claude Opus 5.5), not by navinor personally. ## What and why Fixes #4416: a falling armor stand moved in steps instead of sliding down like it does in vanilla. Vanilla's `EntityRenderer` draws every entity at `Mth.lerp(partialTick, xo, x)` (and `yo`, `zo`), and `ClientLevel.tickNonPassenger` saves `xo` through `setOldPosAndRot` before each tick. Horizon's boats, TNT, tridents and mobs already keep a previous position for that. Armor stands didn't: `armor_stand_geometry` placed the model at `a.position` and passed that same point as both ends of the culling box. So on a server's client (the server thread included) a falling stand moved once a tick, while the frames in between drew it in the same place. This PR: - adds `ArmorStand::previous` (the spawn position in `ArmorStand::new`), `ArmorStand::render_position(alpha)`, and `ArmorStand::interpolate(step)`, which saves `previous` and then takes the interpolation step. The client tick calls it for each stand; - seats a stand riding a mob or the player at both ends. On a mob, `previous` comes from the vehicle's previous seat, as `position_riders` already does for mob riders (`commonTick` runs before `rideTick`). On the local player, `seat_own_stands` runs after the player's move, from the `previous_position` just saved to the moved position, since vanilla ticks the player (`tickNonPassenger`) before its passengers (`positionRider`). So a name hologram on the player is drawn between the same two points as the player, with no tick of lag; - saves `previous` at the start of the in-frame `tick_armor_stands`. That path is deprecated; without the line it would draw stands between their spawn point and where they are now; - draws the body, its light, the culling box, the name tag, the flames and the F3+B hitbox at the blended position. The second and third commits treat stands as the living entities they are in vanilla: - An armor stand is a `LivingEntity`, so a vanilla client moves it with the `SteppedInterpolationHandler` over its update interval (3), position and yaw together. `ArmorStand.tickHeadTurn` makes the body follow `yRot`. Horizon eased stands with the generic three-step lerp used for boats and set their yaw at once from each packet. Stands now go through the mobs' `SteppedInterpolation` handler (`move_entity`, stepped in `tick_remote_entities`), and `ArmorStand::interpolate` keeps the yaw continuous and saves `yBodyRotO`. The renderer and the F3+B hitbox turn the body by `Mth.rotLerp(partialTick, yBodyRotO, yBodyRot)` (`ArmorStand::render_yaw`). The mob and stand branches of `move_entity` share `stepped_move`. - A move of more than 64 blocks snaps (`tooBigToInterpolate`), with nothing left to blend from (`Entity.snapTo`, `ArmorStand::snap`). - `TeleportEntity` now snaps too, as `setValuesFromPositionPacket` does. Before, only `EntityPositionSync` did, so a far-teleported mob also slid there over three ticks. - The two packets measure the distance differently. A teleport goes from `PositionMoveRotation.of(entity)`, which is `getClientPositionAndRotation()`: the interpolation target while one runs. A position sync goes from the entity's position. `MovePacket::snaps` keeps them apart. - A snapped mob now resets its previous yaw and pitch as well as its position (`setOldPosAndRot`), so it doesn't spin for a frame. - Every spawn starts with a fresh interpolation handler, a stand's included, even under an id the server used before. Not in this PR: - After a far snap, vanilla keeps the handler running, and its next step shifts the remaining steps by the jump (`adjustInterpolationTargetFromDeltas`, collision-checked). Horizon's handler doesn't port that, so the steps are dropped, as they already were for mobs. For an entity that wasn't moving the result is the same. - `TeleportEntity`'s relative flags (position and rotation) are still resolved against the last position the server sent. Vanilla's server sends relative teleports only to the player controlling the vehicle (`Entity.sendTeleportTransitionToPlayers`), and Horizon handles that mount on its own path. - A stand riding a living entity still turns its body by its own yaw, not by its vehicle's (`solveBodyRot`'s riding branch). - Boats and minecarts on the generic `lerps` still slide on a far teleport. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Vanilla reference `net.minecraft.client.renderer.entity.EntityRenderer` (the `Mth.lerp(partialTick, entity.xo, entity.getX())` render position and `getBoundingBoxForCulling(entity, partialTicks)`), `net.minecraft.client.multiplayer.ClientLevel.tickNonPassenger` / `tickPassenger` (`setOldPosAndRot` before `tick` / `rideTick`), `LivingEntityRenderer.solveBodyRot`, `ArmorStand.tickHeadTurn`, `LivingEntity.createInterpolationHandler`, `ClientPacketListener.handleEntityPositionSync` and `setValuesFromPositionPacket` (`tooBigToInterpolate`), `Entity.snapTo`. What checks it: - `entities::armor_stand_render_tests`: - `a_falling_stand_is_drawn_between_its_ticks` runs a stand through `interpolate` as the client tick does. It draws at its spawn point when new, at 70, 69.75 and 69 for partial ticks 0, 0.25 and 1 after a 1-block step, halfway through the next step, and stays put once no step is due. - `a_turning_stand_is_drawn_between_its_ticks`: from 170° to -170° the body passes through 180°, the short way. - `a_snapped_stand_is_drawn_where_it_landed`: after a snap, every frame draws it at the new place and yaw. - `game::remote::tests`: - `a_far_move_snaps_by_the_packets_own_measure`: an entity at x 0 headed for x 50 snaps on a position sync to x 100 but not on a teleport there. With nothing in flight, both measure from the entity. - `a_living_entitys_move_snaps_or_steps`: an entity walking toward x 5 gets a far sync and is put there with no step back toward x 5 left (it fails without `handler.cancel()` in `stepped_move`). A rotation-only move keeps the position and turns from 90° through 120° and 150° to 180°, one step per tick. - `tools/lan_e2e.py`, server-thread host and a guest, on Windows: - `objects` (pass): now also summons a stand 3 blocks up turned to 200°, so where it lands and its yaw are compared between host and guest, along with the other 15 objects. - `levels` (pass): its `ticking` step drops a stand in each level and checks the guest's copy lands on the floor. One run before this missed the host's pig (a pig wandering out of the 8-block search; the server-side `kill` didn't find it either), and the rerun passed every step. - `frames` (pass): the stand's helmet on and off and the turned frame match on both sides. - A real game against a vanilla 26.3 server (offline mode), driven with `horizon-ctl`. I set `/tick rate 2` (500 ms ticks; Horizon's client follows it through `ClientboundTickingState`), summoned a stand 10 blocks up in front of the camera, and took 16 screenshots about 70 ms apart, 3.5 s into the fall. The numbers are the top row of the stand's pixels in each one: - `main`: `51 51 51 51 51 51 51 61 61 61 61 61 61 61 61 82`. 13 of 15 frames repeat the one before; the stand jumps 10 to 20 px once a tick. - this PR: `50 52 53 54 56 57 59 60 62 63 64 66 67 69 70 71`. No frame repeats. - The same setup, reading the stand's position and yaw from `horizon-ctl status` every 250 ms (each tick is 500 ms): - `/tp` the stand to yaw 90: on `main` the yaw goes from 0 to 90 in one tick. With this PR it goes 0, 30, 60, 90, one step per tick, which is the stepped handler with an interval of 3. - `/tp` the stand 70 blocks east: on `main` it slides x = -39.5, -16.2, 7.2, 30.5 over three ticks. With this PR it is at 30.5 on the first reading after the packet. ## Other projects' code None. ## Self-check After the review fixes I merged main (`f99f8feaa`, which has #5299's `windows-sys` features). On that merge, on Windows: `cargo fmt --check` and `cargo clippy -p horizon-client --lib --bins --tests -- -D warnings` pass, and the stand, rider and move tests pass (12). `port_ledger.py check --base origin/main` no longer lists the `Entity.snapTo` or `ClientLevel.tickNonPassenger` gaps. The table below is the earlier run, before the merge. **pr_ready** (`tools/pr_ready.py --quick` on Aaron, against origin/main at b8cf85f8c, 4 min 44 s) | Check | Result | | --- | --- | | Scope | ✅ 9 files, +319 −70 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 500 run, FAILED (errors=1, skipped=12) (1 min 1 s) | | rustfmt | ✅ (8 s) | | clippy | ❌ failed (3 s) | | tests: horizon-client, horizon-threads | ❌ 1383 passed, 1 failed (3 min 25 s) | | doc tests | ✅ 0 passed (3 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 | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | I ran this on Windows, where main at `b8cf85f8c` doesn't build `horizon-threads` without the `windows-sys` features #5299 adds. I applied those locally, which is the 9th file and the `horizon-threads` in the table; they aren't in this PR. The three ❌ rows fail the same way on `b8cf85f8c` without this PR: - Python: `test_perf_bench.test_table_distinguishes_missing_scene_load_from_zero` (`ValueError: cannot compare RD 8`). This PR changes no Python. - clippy: `clippy::unnecessary_mut_passed` in `horizon-threads/src/boot_paint.rs:47`, the file #5299 touches. `cargo clippy -p horizon-client --lib --bins --tests -- -D warnings -A clippy::unnecessary_mut_passed` passes. - tests: `native_hooks::tests::property_setters_refuse_no_change`, which searches its own source for `\n` and finds `\r\n` in a Windows checkout (`core.autocrlf=true`). Outside pr_ready: the `lan_bot` integration test has 8 of 14 failing, the same 8 on `b8cf85f8c` (the hub.rs part of #5299). `forced_chunks`, `generation_saves`, `launch_api`, `streaming_meshes`, `tall_column` and `wide_states` pass. Harnesses weren't run here because `tools/parity.py` needs `fcntl`. 🤖 Generated with [OpenCode](https://opencode.ai) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:17:54 +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#6294
No description provided.