[PR #6732] [MERGED] Items and primed TNT bounce and slide on slime like vanilla #7061

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

📋 Pull Request Information

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

Base: main ← Head: fix/items-on-slime


📝 Commits (3)

  • b32c93c Items and primed TNT bounce and slide on slime like vanilla
  • 3032e8c Merge remote-tracking branch 'origin/main' into fix/items-on-slime
  • 6ed4e7e Regenerate the mod API output after the merge with main

📊 Changes

3 files changed (+139 additions, -33 deletions)

View changed files

📝 crates/horizon-client/src/entities.rs (+103 -26)
📝 crates/horizon-client/src/game/tnt.rs (+34 -6)
📝 crates/horizon-client/src/mod_api/generated.rs (+2 -1)

📄 Description

🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself.

What and why

Dropped items and primed TNT landing on, and sliding over, slime blocks did not move like vanilla. Three causes, all in Entity.move and SlimeBlock:

  1. The bounce speed was -y * 0.8. Vanilla's restituteMovementAfterCollisions also adds back the gravity and air drag of the part of the tick after the hit: (portion * gravity - y) * lerp(portion, 1, 0.98) * 0.8f. A 6-block drop came back 3.4% too slow, and the gap grew with each tick of the flight.
  2. SlimeBlock.stepOn was missing for items and TNT. On the ground with |dy| < 0.1, vanilla scales the horizontal speed by 0.4 + |dy| * 0.2, on idle ticks as well; the horizontal speed on the landing tick was 2.4x too high.
  3. Primed TNT zeroed its Y speed on any vertical hit, so it never bounced on slime. It now uses the same restitution as items.

Also from Entity.move: a collided step shorter than sqrt(1e-7) is not applied to the position, which showed as 1e-5 drift on a slow item resting on slime. The restitution is called for a downward move that hits the floor even when the floor stops it completely, which is why an item at rest on slime keeps hopping in vanilla.

Changed: crates/horizon-client/src/entities.rs and crates/horizon-client/src/game/tnt.rs.

Fixes #6731

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

Entity.restituteMovementAfterCollisions, Entity.getBlockBounciness (non-living: * 0.8f), Entity.move (the 1.0E-7 position gate), SlimeBlock.stepOn, ItemEntity.tick, PrimedTnt.tick.

Test

slime_bounce_tests in entities.rs now check the bounce speed and the stepOn scale against numbers measured on a vanilla 26.3 server (a -0.6097 fall stopped 0.4865 down gives 0.4950 / 0.98; a -0.0792 fall stopped 0.06 down gives 0.0862; scale 0.41724 at dy 0.0862).

Numbers

Side-by-side slime scene (items dropped from 6 blocks, pushed along the slime, dropped with sideways speed; primed TNT dropped from 6; experience orb, falling block, snowball and arrow dropped for comparison), 30 ticks, 24 values per tick (Pos, Motion, OnGround), tolerance 1e-5, vanilla run twice:

values matching vanilla
Horizon before 586 / 720
Horizon after 720 / 720

First bounce of the dropped item, Y speed after the tick: vanilla 0.4950, before 0.4780, after 0.4950. Item pushed at 0.4 over slime, X speed after the first landing tick: vanilla 0.1282, before 0.3073, after 0.1282. TNT Y speed three ticks after landing: vanilla -0.1127, before -0.0, after -0.1127.

Vanilla differential harnesses covering the moved code (restitution, entity_move, block_landing): 3 passed, 0 failed. The full --changed run was not completed.

The orb, falling block, snowball and arrow already matched before the change. The items, fall_on and tnt_fluids scenes show no change from this fix (their remaining differences, free-fall drift of 2e-5 after 200 ticks and a honey-block item that Horizon despawns, are the same in an earlier run of an older origin/main build).

What wasn't compared

  • Minecarts, boats and other vehicles were not run on slime.
  • The bounce sound and game event (bounceOn) are not played for items or TNT.
  • A slime block carried by a moving piston (item landing on it) was not compared against vanilla.
  • Not added to lan_e2e: the effect is server-side motion and the side-by-side scene covers it with vanilla numbers.

Proved by script against the real 26.3 server; no human played this change.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick on Valhalla, against origin/main at b8f73142f, 13 min 36 s)

Check Result
Scope ✅ 3 files, +139 −33
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 602 passed (1 min 2 s)
rustfmt ✅ (17 s)
Rust ⚠️ 1.98.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with rustup update
clippy ✅ (3 min 15 s)
tests: horizon-client, horizon-client-lib ✅ 1979 passed (8 min 34 s)
doc tests ✅ 0 passed (6 s)
content root tests ➖ content root untouched
mod API up to date ✅ (8 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 265 affected, to run in CI (--quick): armor_stand_frost, arrow, arrow_wind_charge, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, block_tint, block_transformer, boat_authority and 253 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Claude Code

https://claude.ai/code/session_018zuDTsnyHkP28bzn3u7S3m


🔄 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/6732 **Author:** [@HrafnaValkyrja](https://github.com/HrafnaValkyrja) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/items-on-slime` --- ### 📝 Commits (3) - [`b32c93c`](https://github.com/horizon-rust/horizon/commit/b32c93c4d68172efeb1bde7ba6bfd782d820a239) Items and primed TNT bounce and slide on slime like vanilla - [`3032e8c`](https://github.com/horizon-rust/horizon/commit/3032e8c55ae8693aa61fa4275c43a44d91691f09) Merge remote-tracking branch 'origin/main' into fix/items-on-slime - [`6ed4e7e`](https://github.com/horizon-rust/horizon/commit/6ed4e7ef688a3514fc5eac195226f642c4f24fb2) Regenerate the mod API output after the merge with main ### 📊 Changes **3 files changed** (+139 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entities.rs` (+103 -26) 📝 `crates/horizon-client/src/game/tnt.rs` (+34 -6) 📝 `crates/horizon-client/src/mod_api/generated.rs` (+2 -1) </details> ### 📄 Description > 🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself. ## What and why Dropped items and primed TNT landing on, and sliding over, slime blocks did not move like vanilla. Three causes, all in `Entity.move` and `SlimeBlock`: 1. The bounce speed was `-y * 0.8`. Vanilla's `restituteMovementAfterCollisions` also adds back the gravity and air drag of the part of the tick after the hit: `(portion * gravity - y) * lerp(portion, 1, 0.98) * 0.8f`. A 6-block drop came back 3.4% too slow, and the gap grew with each tick of the flight. 2. `SlimeBlock.stepOn` was missing for items and TNT. On the ground with `|dy| < 0.1`, vanilla scales the horizontal speed by `0.4 + |dy| * 0.2`, on idle ticks as well; the horizontal speed on the landing tick was 2.4x too high. 3. Primed TNT zeroed its Y speed on any vertical hit, so it never bounced on slime. It now uses the same restitution as items. Also from `Entity.move`: a collided step shorter than `sqrt(1e-7)` is not applied to the position, which showed as 1e-5 drift on a slow item resting on slime. The restitution is called for a downward move that hits the floor even when the floor stops it completely, which is why an item at rest on slime keeps hopping in vanilla. Changed: `crates/horizon-client/src/entities.rs` and `crates/horizon-client/src/game/tnt.rs`. Fixes #6731 ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference `Entity.restituteMovementAfterCollisions`, `Entity.getBlockBounciness` (non-living: `* 0.8f`), `Entity.move` (the `1.0E-7` position gate), `SlimeBlock.stepOn`, `ItemEntity.tick`, `PrimedTnt.tick`. ## Test `slime_bounce_tests` in `entities.rs` now check the bounce speed and the `stepOn` scale against numbers measured on a vanilla 26.3 server (a -0.6097 fall stopped 0.4865 down gives 0.4950 / 0.98; a -0.0792 fall stopped 0.06 down gives 0.0862; scale 0.41724 at dy 0.0862). ## Numbers Side-by-side `slime` scene (items dropped from 6 blocks, pushed along the slime, dropped with sideways speed; primed TNT dropped from 6; experience orb, falling block, snowball and arrow dropped for comparison), 30 ticks, 24 values per tick (Pos, Motion, OnGround), tolerance 1e-5, vanilla run twice: | | values matching vanilla | |---|---| | Horizon before | 586 / 720 | | Horizon after | 720 / 720 | First bounce of the dropped item, Y speed after the tick: vanilla 0.4950, before 0.4780, after 0.4950. Item pushed at 0.4 over slime, X speed after the first landing tick: vanilla 0.1282, before 0.3073, after 0.1282. TNT Y speed three ticks after landing: vanilla -0.1127, before -0.0, after -0.1127. Vanilla differential harnesses covering the moved code (`restitution`, `entity_move`, `block_landing`): 3 passed, 0 failed. The full `--changed` run was not completed. The orb, falling block, snowball and arrow already matched before the change. The `items`, `fall_on` and `tnt_fluids` scenes show no change from this fix (their remaining differences, free-fall drift of 2e-5 after 200 ticks and a honey-block item that Horizon despawns, are the same in an earlier run of an older origin/main build). ## What wasn't compared - Minecarts, boats and other vehicles were not run on slime. - The bounce sound and game event (`bounceOn`) are not played for items or TNT. - A slime block carried by a moving piston (item landing on it) was not compared against vanilla. - Not added to `lan_e2e`: the effect is server-side motion and the side-by-side scene covers it with vanilla numbers. Proved by script against the real 26.3 server; no human played this change. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on Valhalla, against origin/main at b8f73142f, 13 min 36 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +139 −33 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 602 passed (1 min 2 s) | | rustfmt | ✅ (17 s) | | Rust | ⚠️ 1.98.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with `rustup update` | | clippy | ✅ (3 min 15 s) | | tests: horizon-client, horizon-client-lib | ✅ 1979 passed (8 min 34 s) | | doc tests | ✅ 0 passed (6 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (8 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 265 affected, to run in CI (--quick): armor_stand_frost, arrow, arrow_wind_charge, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, block_tint, block_transformer, boat_authority and 253 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018zuDTsnyHkP28bzn3u7S3m --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:33:02 +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#7061
No description provided.