[PR #5972] [MERGED] Thrown potions hit players, and their thrower after leaving them #6587

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

📋 Pull Request Information

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

Base: main ← Head: fix/splash-hits-thrower


📝 Commits (1)

  • 7fd4809 Thrown potions hit players, and their thrower after leaving them

📊 Changes

2 files changed (+192 additions, -11 deletions)

View changed files

📝 crates/horizon-client/src/game/fireworks.rs (+7 -2)
📝 crates/horizon-client/src/game/potions.rs (+185 -9)

📄 Description

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

What and why

tick_thrown_potions (game/potions.rs) stopped a potion at a block or a mob only, so a splash, lingering or
experience potion passed through any player: a potion thrown up fell through its thrower, and through other
players (the host and every guest).

  • The step now also meets players (host and lan_projectile_targets() guests), box grown by the pick margin, which grows with the potion's age (ProjectileUtil.computeMargin, 0 to 0.3).
  • ThrownPotion gets thrower / guest / left_owner, as Rocket has (fireworks.rs). The thrower is not hit
    until the potion has left them. launch_thrown records the thrower and lan_acting, so a guest's potion is
    theirs; a dispenser's has none and is clear at once.
  • Rocket's owner lookup is now shooter_who(owner, guest) in fireworks.rs, shared by the potion.
  • Splash, lingering and XP bottle share this loop, so all three are fixed. Snowballs, eggs and ender pearls are
    projectiles::Projectile, which already has left_owner and player targets: no gap, untouched. Witch potions
    are also Projectile. Tridents and remote (server-driven) potions are separate paths and untouched.
  • Test: a_thrown_potion_hits_its_thrower_only_after_leaving_them (potions.rs), on the two pure helpers.
  • The left-owner check runs before the move, and the thrower's whole vehicle group is skipped until the potion leaves it: the thrower, other riders, and a mob mount. Boats aren't hit targets in this engine, but their box still counts for leaving. Only the root vehicle is handled, so nested mounts aren't.

Fixes #5876

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

  • Projectile.tick: checkLeftOwner(), super.tick(), then leftOwnerChecked = false.
  • Projectile.checkLeftOwner / isOutsideOwnerCollisionRange: left once no pickable box of the owner's root
    vehicle and passengers meets getBoundingBox().expandTowards(delta).inflate(1.0); no owner is left.
  • Projectile.canHitEntity: owner == null || leftOwner || !owner.isPassengerOfSameVehicle(entity).
  • ThrowableProjectile.tick: hit result from getHitResultOnMoveVector(this, canHitEntity) with the leftOwner of
    the previous tick, setPos, then super.tick() (the leftOwner check at the new position), then onHit.
  • AbstractThrownPotion.onHit / ThrownSplashPotion.onHitAsPotion: unchanged (the AoE already reaches players).

Unverified: the direct-hit full strength of applySplash for the entity hit (mobs have the same gap); riders and
vehicles (isPassengerOfSameVehicle) are not modelled, as for rockets.

  • ThrownSplashPotion.onHitAsPotion: scale = 1 - sqrt(dist)/4. There is no separate direct-hit strength; a direct hit has dist 0, so scale 1.0. The existing splash_distance_sqr already matched.

Test: a_thrown_potion_hits_its_thrower_only_after_leaving_them. Valkyrie tested by hand in game: splash thrown straight up, in a boat, lingering on the ground and in vehicles, and XP bottles. All worked. No scripted end-to-end check: a potion that misses still splashes the player from the floor, so it can't tell a hit from a miss. Still a sampled point test, not vanilla's swept box.

Other projects' code

none

Self-check

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

Check Result
Scope ✅ 3 files, +192 −11
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 515 passed (20 s)
rustfmt ✅ (7 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 ✅ (2 min 5 s)
tests: horizon-client ✅ 1679 passed (2 min 1 s)
doc tests ✅ 0 passed (1 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 ➖ 317 affected, to run in CI (--quick): block_removal, bulk_section, bundle_weight, camera, canyon_carver, carving_geometry, carving_mask, cauldron, cave_carver, chat_screen, chest_pair, chorus_plant and 305 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/5972 **Author:** [@HrafnaValkyrja](https://github.com/HrafnaValkyrja) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/splash-hits-thrower` --- ### 📝 Commits (1) - [`7fd4809`](https://github.com/horizon-rust/horizon/commit/7fd48091ae23a0a1ff3c31c6491b9acf895c8be1) Thrown potions hit players, and their thrower after leaving them ### 📊 Changes **2 files changed** (+192 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/fireworks.rs` (+7 -2) 📝 `crates/horizon-client/src/game/potions.rs` (+185 -9) </details> ### 📄 Description > 🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself. ## What and why `tick_thrown_potions` (game/potions.rs) stopped a potion at a block or a mob only, so a splash, lingering or experience potion passed through any player: a potion thrown up fell through its thrower, and through other players (the host and every guest). - The step now also meets players (host and `lan_projectile_targets()` guests), box grown by the pick margin, which grows with the potion's age (`ProjectileUtil.computeMargin`, 0 to 0.3). - `ThrownPotion` gets `thrower` / `guest` / `left_owner`, as `Rocket` has (fireworks.rs). The thrower is not hit until the potion has left them. `launch_thrown` records the thrower and `lan_acting`, so a guest's potion is theirs; a dispenser's has none and is clear at once. - `Rocket`'s owner lookup is now `shooter_who(owner, guest)` in fireworks.rs, shared by the potion. - Splash, lingering and XP bottle share this loop, so all three are fixed. Snowballs, eggs and ender pearls are `projectiles::Projectile`, which already has `left_owner` and player targets: no gap, untouched. Witch potions are also `Projectile`. Tridents and remote (server-driven) potions are separate paths and untouched. - Test: `a_thrown_potion_hits_its_thrower_only_after_leaving_them` (potions.rs), on the two pure helpers. - The left-owner check runs before the move, and the thrower's whole vehicle group is skipped until the potion leaves it: the thrower, other riders, and a mob mount. Boats aren't hit targets in this engine, but their box still counts for leaving. Only the root vehicle is handled, so nested mounts aren't. Fixes #5876 ## 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 - `Projectile.tick`: `checkLeftOwner()`, `super.tick()`, then `leftOwnerChecked = false`. - `Projectile.checkLeftOwner` / `isOutsideOwnerCollisionRange`: left once no pickable box of the owner's root vehicle and passengers meets `getBoundingBox().expandTowards(delta).inflate(1.0)`; no owner is left. - `Projectile.canHitEntity`: `owner == null || leftOwner || !owner.isPassengerOfSameVehicle(entity)`. - `ThrowableProjectile.tick`: hit result from `getHitResultOnMoveVector(this, canHitEntity)` with the leftOwner of the previous tick, `setPos`, then `super.tick()` (the leftOwner check at the new position), then `onHit`. - `AbstractThrownPotion.onHit` / `ThrownSplashPotion.onHitAsPotion`: unchanged (the AoE already reaches players). Unverified: the direct-hit full strength of `applySplash` for the entity hit (mobs have the same gap); riders and vehicles (`isPassengerOfSameVehicle`) are not modelled, as for rockets. - `ThrownSplashPotion.onHitAsPotion`: `scale = 1 - sqrt(dist)/4`. There is no separate direct-hit strength; a direct hit has `dist` 0, so `scale` 1.0. The existing `splash_distance_sqr` already matched. Test: `a_thrown_potion_hits_its_thrower_only_after_leaving_them`. Valkyrie tested by hand in game: splash thrown straight up, in a boat, lingering on the ground and in vehicles, and XP bottles. All worked. No scripted end-to-end check: a potion that misses still splashes the player from the floor, so it can't tell a hit from a miss. Still a sampled point test, not vanilla's swept box. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on Valhalla, against origin/main at c1f4a7c19, 4 min 36 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +192 −11 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 515 passed (20 s) | | rustfmt | ✅ (7 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 | ✅ (2 min 5 s) | | tests: horizon-client | ✅ 1679 passed (2 min 1 s) | | doc tests | ✅ 0 passed (1 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 | ➖ 317 affected, to run in CI (--quick): block_removal, bulk_section, bundle_weight, camera, canyon_carver, carving_geometry, carving_mask, cauldron, cave_carver, chat_screen, chest_pair, chorus_plant and 305 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:23:28 +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#6587
No description provided.