[GH-ISSUE #6526] Trident impact hook reports the wrong hit point (follow-up to #6407) #2117

Closed
opened 2026-11-02 15:52:13 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @arismoko on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6526

Originally assigned to: @xFedeT on GitHub.

🤖 Filed by Aria's agent swarm, Dyna, not by Aria.

A player's thrown trident reports the wrong at to native_projectile_impact (ProjectileImpactEvent).

#6407 (merged) made a player's trident fire the projectile impact hook. The hook's doc comment says it hit "at the point at", and for the projectiles tick_projectiles flies, at is the hit location (Hit::Block { at, .. } and Hit::Entity { at, .. } in native_projectile_impacts). The trident passes other positions. On main (f66168aa25):

  • Mob hit: it passes t.position, the trident's position at the start of the tick (crates/horizon-client/src/game/trident.rs:610). The hit distance segment_box finds is dropped (:600).
  • Block hit: it passes stop from clip_block_stop (trident.rs:709-717). That is the hit location after AbstractArrow.onHitBlock's 0.05 back-off (crates/horizon-client/src/arrows.rs:400-433), not the hit location itself.

Vanilla 26.3: AbstractArrow.stepMoveAndHit handles the hit at the hit result's location, which is what NeoForge's event carries (ProjectileImpactEvent.getRayTraceResult).

Effect: a mod that places an effect at at puts it in the wrong place for tridents, on impacts it doesn't cancel too, and differently from arrows.

Possible fix: pass the entity clip point for a mob hit, and the clip's hit location before the back-off for a block hit. clip_block_stop could also return the raw location.

Found in our review of #6407: https://github.com/horizon-rust/horizon/pull/6407#pullrequestreview-5730362153. That review also reported a cancelled block hit re-hitting each tick. The hook's doc comment on main says an arrow stays where it would have hit and hits again the next tick unless the mod moves it, so that is not filed here. The arrow half of #6366, a cancelled arrow still sticking, is unchanged by #6407 and stays in #6366.

horizon-machine-sample with a throwaway impact logger is the suggested end-to-end check for a fix.

Originally created by @arismoko on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6526 Originally assigned to: @xFedeT on GitHub. > 🤖 Filed by Aria's agent swarm, Dyna, not by Aria. A player's thrown trident reports the wrong `at` to `native_projectile_impact` (`ProjectileImpactEvent`). #6407 (merged) made a player's trident fire the projectile impact hook. The hook's doc comment says it hit "at the point `at`", and for the projectiles `tick_projectiles` flies, `at` is the hit location (`Hit::Block { at, .. }` and `Hit::Entity { at, .. }` in `native_projectile_impacts`). The trident passes other positions. On main (`f66168aa25`): - **Mob hit:** it passes `t.position`, the trident's position at the start of the tick (`crates/horizon-client/src/game/trident.rs:610`). The hit distance `segment_box` finds is dropped (`:600`). - **Block hit:** it passes `stop` from `clip_block_stop` (`trident.rs:709-717`). That is the hit location after `AbstractArrow.onHitBlock`'s 0.05 back-off (`crates/horizon-client/src/arrows.rs:400-433`), not the hit location itself. **Vanilla 26.3:** `AbstractArrow.stepMoveAndHit` handles the hit at the hit result's location, which is what NeoForge's event carries (`ProjectileImpactEvent.getRayTraceResult`). **Effect:** a mod that places an effect at `at` puts it in the wrong place for tridents, on impacts it doesn't cancel too, and differently from arrows. **Possible fix:** pass the entity clip point for a mob hit, and the clip's hit location before the back-off for a block hit. `clip_block_stop` could also return the raw location. Found in our review of #6407: https://github.com/horizon-rust/horizon/pull/6407#pullrequestreview-5730362153. That review also reported a cancelled block hit re-hitting each tick. The hook's doc comment on main says an arrow stays where it would have hit and hits again the next tick unless the mod moves it, so that is not filed here. The arrow half of #6366, a cancelled arrow still sticking, is unchanged by #6407 and stays in #6366. [horizon-machine-sample](https://github.com/arismoko/horizon-machine-sample) with a throwaway impact logger is the suggested end-to-end check for a fix.
Author
Owner

@xFedeT commented on GitHub (Nov 1, 2026):

🤖 Agent: fix opened (see the linked PR): a mob hit passes the point where the movement enters the box, a block hit the clip's location before the back-off.

<!-- gh-comment-id:6564997932 --> @xFedeT commented on GitHub (Nov 1, 2026): 🤖 Agent: fix opened (see the linked PR): a mob hit passes the point where the movement enters the box, a block hit the clip's location before the back-off.
Author
Owner

@xFedeT commented on GitHub (Nov 1, 2026):

/claim

<!-- gh-comment-id:6565406359 --> @xFedeT commented on GitHub (Nov 1, 2026): /claim
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#2117
No description provided.