[PR #4406] [MERGED] Thrown tridents: clip blocks with vanilla's centre ray, not the 0.5 box #5609

Closed
opened 2026-11-03 05:13:45 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4406
Author: @posok124521
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @levzzz5154

Base: main ← Head: fix/trident-block-clip


📝 Commits (1)

  • 726d9e8 Thrown tridents: clip blocks with vanilla's centre ray, not the 0.5 box

📊 Changes

5 files changed (+379 additions, -36 deletions)

View changed files

📝 crates/horizon-client/examples/probe/main.rs (+2 -0)
➕ crates/horizon-client/examples/probe/trident_probe.rs (+130 -0)
📝 crates/horizon-client/src/arrows.rs (+55 -0)
📝 crates/horizon-client/src/game/trident.rs (+39 -36)
➕ tools/test_trident_parity.py (+153 -0)

📄 Description

🤖 Opened by posok124521's AI agent (DeepSeek 4.1 Flash), not by posok124521 personally.

What and why

A trident thrown past the corner of a block stopped in mid-air beside it, as if
the block's hitbox were larger than it is: the server-side tick tested blocks
with an AABB sweep of the trident's own 0.5 x 0.5 box and a per-axis
moved != velocity test instead of vanilla's zero-width centre ray. A pass
0.05..0.25 blocks to the side of a block therefore stuck the trident 0.25 blocks
short of the face.

This replaces that step with AbstractArrow.tick's block phase — a
level().clip(new ClipContext(position(), position().add(movement), ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this)) — and
AbstractArrow.onHitBlock's 0.05 pull-back along Math.signum, zero velocity,
inGround = true and shakeTime = 7. The same back-off runs on the client's
predicted copy (ThrownTrident::remote_tick), and the pickup rule waits for
shakeTime as vanilla's does.

Fixes #4365

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

  • AbstractArrow.tick — the block phase: level().clip(...) with
    ClipContext.Block.COLLIDER and ClipContext.Fluid.NONE (Level.clip,
    ClipContext)
  • AbstractArrow.onHitBlock — 0.05 back-off along Math.signum, velocity zero,
    inGround, shakeTime = 7
  • AbstractArrow.stepMoveAndHit — position to the hit location on a hit, the
    full segment on a miss
  • AbstractArrow.playerTouch — no pickup while shakeTime > 0
  • ThrownTrident.tick (delegates to AbstractArrow.tick);
    TridentItem.releaseUsing / Projectile.spawnProjectileFromRotation (throw;
    unchanged here)

Harness: tools/test_trident_parity.py + examples/probe/trident_probe.rs,
against VanillaArrowOracle (reused because the ticked block phase is
AbstractArrow's, shared verbatim with ThrownTrident, which only adds the
inGroundTime > 4/Loyalty pre-step before super.tick()). The harness covers
arrows::clip_block_stop — the block step: ray clip, hit position, 0.05
back-off and the in-ground/shake flags — not the full tick_tridents
(loyalty, mob hits, pickup, audio).

Verification

Vanilla oracle (VanillaArrowOracle, pinned jar), stone block at x 12..13,
y 20..21, z 10..11; first movement 2.5 blocks along +x from z = 10.55..11.30:

 z      inGround  position (x, y, z)            velocity
 10.55    true    (11.9500, 20.5200, 10.5500)  (0, 0, 0)
 10.85    true    (11.9500, 20.5200, 10.8500)  (0, 0, 0)
 11.05    false   (13.0000, 20.5200, 11.0500)  (2.4750, -0.05, 0)
 11.15    false   (13.0000, 20.5200, 11.1500)  (2.4750, -0.05, 0)
 11.30    false   (13.0000, 20.5200, 11.3000)  (2.4750, -0.05, 0)

Live game through horizon-ctl (release build, singleplayer creative,
server-thread path — the default; no --in-frame), stone block at
x 172..173, y 120..121, z 158..159, thrown horizontally into its corner:

z = 158.55  before: stop (171.75, 120.5, 158.5)   after: stop (171.95, 120.5, 158.5)
z = 158.85  before: stop (171.75, 120.5, 158.9)   after: stop (171.95, 120.5, 158.8)
z = 159.05  before: stop (171.75, 120.5, 159.1)   after: flies on (x = 223.7, falling)
z = 159.15  before: stop (171.75, 120.5, 159.2)   after: flies on (x = 224.1, falling)
z = 159.30  before: flies on                      after: flies on

The reporter also confirmed the fix in a normal client session.

Self-check

**pr_ready** (`tools/pr_ready.py --base upstream/main` on chi4a, against upstream/main at e4472a742, 5 min 10 s)

| Check | Result |
| --- | --- |
| Scope | ✅ 5 files, +379 −36 |
| Cargo.lock | ✅ unchanged |
| Public tree | ✅ |
| Python tests | ✅ 480 passed (1 min 36 s) |
| rustfmt | ✅ (17 s) |
| clippy | ❌ failed (13 s) |
| tests: horizon-client | ❌ 656 passed, 76 failed (2 min 54 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 | ❌ 363 affected,  (3 s) |
| Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) |

This ran on Windows, where three checks cannot pass for reasons outside this
change, each reproduced on a clean upstream/main tree (git stash -u):

  • clippy: the workspace-wide -D warnings run fails on
    clippy::missing_const_for_thread_local in horizon-core (and the same lint
    in horizon-relay's test) — files this PR does not touch. On the changed
    package itself (cargo clippy -p horizon-client --all-targets -- -D warnings
    with that pre-existing lint allowed) the build is clean: no diagnostics in
    arrows.rs, game/trident.rs or trident_probe.rs.
  • tests: horizon-client: the same 76 tests fail with and without this
    change; the two failing lists are byte-identical (same MD5). No regression.
  • Parity: tools/parity.py needs fcntl and cannot run on Windows; the new
    harness was run directly instead and all 8 fixtures match the pinned client.

tools/port_ledger.py needs decompiled vanilla sources (tools/lab.py decompile), which this checkout does not have; tools/lan_e2e.py cannot create
its scratch symlinks on Windows (no Developer Mode). CI verify and the
maintainer's run-parity label will confirm all of these on Linux.

Screenshots

No screenshots captured; the before/after positions above are the
player-visible difference (a trident that used to hang beside a block now flies
on).

🤖 Generated with DeepSeek Harness (DeepSeek 4.1 Flash, model deepseek-flash).


🔄 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/4406 **Author:** [@posok124521](https://github.com/posok124521) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/trident-block-clip` --- ### 📝 Commits (1) - [`726d9e8`](https://github.com/horizon-rust/horizon/commit/726d9e86ef1f7044b83b5b1c6690231ab9ea1edc) Thrown tridents: clip blocks with vanilla's centre ray, not the 0.5 box ### 📊 Changes **5 files changed** (+379 additions, -36 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/probe/main.rs` (+2 -0) ➕ `crates/horizon-client/examples/probe/trident_probe.rs` (+130 -0) 📝 `crates/horizon-client/src/arrows.rs` (+55 -0) 📝 `crates/horizon-client/src/game/trident.rs` (+39 -36) ➕ `tools/test_trident_parity.py` (+153 -0) </details> ### 📄 Description > 🤖 Opened by posok124521's AI agent (DeepSeek 4.1 Flash), not by posok124521 personally. ## What and why A trident thrown past the corner of a block stopped in mid-air beside it, as if the block's hitbox were larger than it is: the server-side tick tested blocks with an AABB sweep of the trident's own 0.5 x 0.5 box and a per-axis `moved != velocity` test instead of vanilla's zero-width centre ray. A pass 0.05..0.25 blocks to the side of a block therefore stuck the trident 0.25 blocks short of the face. This replaces that step with `AbstractArrow.tick`'s block phase — a `level().clip(new ClipContext(position(), position().add(movement), ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this))` — and `AbstractArrow.onHitBlock`'s 0.05 pull-back along `Math.signum`, zero velocity, `inGround = true` and `shakeTime = 7`. The same back-off runs on the client's predicted copy (`ThrownTrident::remote_tick`), and the pickup rule waits for `shakeTime` as vanilla's does. Fixes #4365 ## 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 - `AbstractArrow.tick` — the block phase: `level().clip(...)` with `ClipContext.Block.COLLIDER` and `ClipContext.Fluid.NONE` (`Level.clip`, `ClipContext`) - `AbstractArrow.onHitBlock` — 0.05 back-off along `Math.signum`, velocity zero, `inGround`, `shakeTime = 7` - `AbstractArrow.stepMoveAndHit` — position to the hit location on a hit, the full segment on a miss - `AbstractArrow.playerTouch` — no pickup while `shakeTime > 0` - `ThrownTrident.tick` (delegates to `AbstractArrow.tick`); `TridentItem.releaseUsing` / `Projectile.spawnProjectileFromRotation` (throw; unchanged here) Harness: `tools/test_trident_parity.py` + `examples/probe/trident_probe.rs`, against `VanillaArrowOracle` (reused because the ticked block phase is `AbstractArrow`'s, shared verbatim with `ThrownTrident`, which only adds the `inGroundTime > 4`/Loyalty pre-step before `super.tick()`). The harness covers `arrows::clip_block_stop` — the block step: ray clip, hit position, 0.05 back-off and the in-ground/shake flags — **not** the full `tick_tridents` (loyalty, mob hits, pickup, audio). ## Verification Vanilla oracle (`VanillaArrowOracle`, pinned jar), stone block at x 12..13, y 20..21, z 10..11; first movement 2.5 blocks along +x from z = 10.55..11.30: ``` z inGround position (x, y, z) velocity 10.55 true (11.9500, 20.5200, 10.5500) (0, 0, 0) 10.85 true (11.9500, 20.5200, 10.8500) (0, 0, 0) 11.05 false (13.0000, 20.5200, 11.0500) (2.4750, -0.05, 0) 11.15 false (13.0000, 20.5200, 11.1500) (2.4750, -0.05, 0) 11.30 false (13.0000, 20.5200, 11.3000) (2.4750, -0.05, 0) ``` Live game through `horizon-ctl` (release build, singleplayer creative, **server-thread** path — the default; no `--in-frame`), stone block at x 172..173, y 120..121, z 158..159, thrown horizontally into its corner: ``` z = 158.55 before: stop (171.75, 120.5, 158.5) after: stop (171.95, 120.5, 158.5) z = 158.85 before: stop (171.75, 120.5, 158.9) after: stop (171.95, 120.5, 158.8) z = 159.05 before: stop (171.75, 120.5, 159.1) after: flies on (x = 223.7, falling) z = 159.15 before: stop (171.75, 120.5, 159.2) after: flies on (x = 224.1, falling) z = 159.30 before: flies on after: flies on ``` The reporter also confirmed the fix in a normal client session. ## Self-check ``` **pr_ready** (`tools/pr_ready.py --base upstream/main` on chi4a, against upstream/main at e4472a742, 5 min 10 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +379 −36 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 480 passed (1 min 36 s) | | rustfmt | ✅ (17 s) | | clippy | ❌ failed (13 s) | | tests: horizon-client | ❌ 656 passed, 76 failed (2 min 54 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 | ❌ 363 affected, (3 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | ``` This ran on Windows, where three checks cannot pass for reasons outside this change, each reproduced on a clean `upstream/main` tree (`git stash -u`): - **clippy**: the workspace-wide `-D warnings` run fails on `clippy::missing_const_for_thread_local` in `horizon-core` (and the same lint in `horizon-relay`'s test) — files this PR does not touch. On the changed package itself (`cargo clippy -p horizon-client --all-targets -- -D warnings` with that pre-existing lint allowed) the build is clean: no diagnostics in `arrows.rs`, `game/trident.rs` or `trident_probe.rs`. - **tests: horizon-client**: the same 76 tests fail with and without this change; the two failing lists are byte-identical (same MD5). No regression. - **Parity**: `tools/parity.py` needs `fcntl` and cannot run on Windows; the new harness was run directly instead and all 8 fixtures match the pinned client. `tools/port_ledger.py` needs decompiled vanilla sources (`tools/lab.py decompile`), which this checkout does not have; `tools/lan_e2e.py` cannot create its scratch symlinks on Windows (no Developer Mode). CI `verify` and the maintainer's `run-parity` label will confirm all of these on Linux. ## Screenshots No screenshots captured; the before/after positions above are the player-visible difference (a trident that used to hang beside a block now flies on). 🤖 Generated with DeepSeek Harness (DeepSeek 4.1 Flash, model deepseek-flash). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:13:45 +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#5609
No description provided.