[PR #4222] [MERGED] A pearl turns the wind charge it hits, which then speeds up #5497

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

📋 Pull Request Information

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

Base: main ← Head: fix/pearl-turns-wind-charge


📝 Commits (1)

  • 2d41c9d A pearl turns the wind charge it hits, which then speeds up

📊 Changes

7 files changed (+224 additions, -9 deletions)

View changed files

📝 crates/horizon-client/src/entity_nbt.rs (+16 -0)
📝 crates/horizon-client/src/game/commands.rs (+8 -1)
📝 crates/horizon-client/src/game/creatures.rs (+28 -4)
📝 crates/horizon-client/src/game/deflect.rs (+73 -0)
📝 crates/horizon-client/src/game/persist.rs (+6 -1)
📝 crates/horizon-client/src/projectiles.rs (+27 -3)
➕ tools/test_pearl_wind_charge_parity.py (+66 -0)

📄 Description

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

What and why

#3599 made a pearl that hits a wind charge teleport its thrower, but it left the charge as it was. In vanilla the charge also turns: after a pearl catch it flies along the thrower's look and speeds up, which is the part of the catch #3299's second report asks for ("the windcharge after can be controlled by the angle that you're looking at"). This builds on #3599.

  • Projectile.onHit → onRedirectProjectile: the pearl's hit runs deflect(AIM_DEFLECT, owner, owner, true, 1.0) on the charge. Its movement becomes the owner's look (aim_deflect, owner_look: host, guest or mob), the owner becomes its owner, and its acceleration power becomes 0.1. Each charge now has its own hit id (WIND_CHARGE_IDS + j) instead of the shared WIND_CHARGE_HIT, so the hit knows which one to turn.
  • AbstractHurtingProjectile.applyInertia: wind charges skipped it, so the power had no effect. They now run it with power 0 and inertia 1 in and out of water (AbstractWindCharge's constructors, getInertia, getLiquidInertia), which leaves an unturned charge's speed exactly as it was.
  • A charge discarded earlier in the same tick is no longer a target (canBeHitByProjectile's isAlive).

Two gaps the harness ran into, fixed because it needs them:

  • /summon minecraft:wind_charge answered "Summoned" and made nothing, and saved charges were dropped on load: fireball_from_nbt and persist.rs now take both wind charges.
  • Selectors skipped wind charges: @e[type=minecraft:wind_charge] now finds them. Saving them back is not part of this: fireball_to_nbt still doesn't write them, so they don't survive a save and /data get has nothing to show for one.

Scope is pearls hitting wind charges, as in #3599. Other projectiles (snowballs, eggs, arrows) and ghast fireballs as targets are still missing.

Fixes #3299

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

Read with tools/rea_vanilla.py, and javap for the lambda: Projectile.onHit, onRedirectProjectile, deflect, setOwner, ProjectileDeflection.AIM_DEFLECT (lambda$static$2), AbstractHurtingProjectile.tick, applyInertia, onDeflection, AbstractWindCharge.<init>, getInertia, getLiquidInertia, canHitEntity.

Harness: tools/test_pearl_wind_charge_parity.py, on a vanilla and a Horizon dedicated server. A still charge is summoned above Alice, who throws a pearl straight up into it. It compares the height of her teleport to the block, and whether a second later the charge is in a band only a turned, accelerating charge reaches (35 to 47 blocks up by the numbers; a charge at speed 1 stops short). The pearl's inaccuracy is random, so x and z are not compared.

Limits of what was checked:

  • The harness passed on the commit before the rebase onto current main. After the rebase I ran rustfmt, clippy and the touched unit tests only (deflect::, projectiles::tests, entity_nbt).
  • I did not run it against the unfixed code, so the band's power to fail on a charge without acceleration comes from the arithmetic above, not from a run.
  • The selector in the harness uses a wide x,z,dx,dz box on purpose: with only y,dy, vanilla found the charge and Horizon did not. I did not investigate that, and it looks like a separate selector gap.
  • tools/port_ledger.py build failed here (StopIteration, with --jar), so port_ledger check was not run. I did not run the decompile.
  • Not tried in a real game by a person yet.

Self-check

--quick, on the commit before the rebase. Harnesses run separately, one by one: pearl_wind_charge and pearl_death passed.

pr_ready (tools/pr_ready.py --quick --base upstream/main on nixos, against upstream/main at b76ae35f5, 3 min 58 s)

Check Result
Scope ✅ 7 files, +224 −9
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ✅ 480 passed (32 s)
rustfmt ✅ (7 s)
clippy ✅ (23 s)
tests: horizon-client ✅ 965 passed (2 min 52 s)
doc tests ✅ 0 passed (2 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 ➖ 355 affected, to run in CI (--quick)

🤖 Generated with Claude Code


🔄 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/4222 **Author:** [@hhamaj](https://github.com/hhamaj) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/pearl-turns-wind-charge` --- ### 📝 Commits (1) - [`2d41c9d`](https://github.com/horizon-rust/horizon/commit/2d41c9d4327c102d3725014c119db4def47aed47) A pearl turns the wind charge it hits, which then speeds up ### 📊 Changes **7 files changed** (+224 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entity_nbt.rs` (+16 -0) 📝 `crates/horizon-client/src/game/commands.rs` (+8 -1) 📝 `crates/horizon-client/src/game/creatures.rs` (+28 -4) 📝 `crates/horizon-client/src/game/deflect.rs` (+73 -0) 📝 `crates/horizon-client/src/game/persist.rs` (+6 -1) 📝 `crates/horizon-client/src/projectiles.rs` (+27 -3) ➕ `tools/test_pearl_wind_charge_parity.py` (+66 -0) </details> ### 📄 Description > 🤖 Opened by hhamaj's AI agent (Claude Code, Opus 5.5), not by hhamaj personally. ## What and why #3599 made a pearl that hits a wind charge teleport its thrower, but it left the charge as it was. In vanilla the charge also turns: after a pearl catch it flies along the thrower's look and speeds up, which is the part of the catch #3299's second report asks for ("the windcharge after can be controlled by the angle that you're looking at"). This builds on #3599. - `Projectile.onHit` → `onRedirectProjectile`: the pearl's hit runs `deflect(AIM_DEFLECT, owner, owner, true, 1.0)` on the charge. Its movement becomes the owner's look (`aim_deflect`, `owner_look`: host, guest or mob), the owner becomes its owner, and its acceleration power becomes 0.1. Each charge now has its own hit id (`WIND_CHARGE_IDS + j`) instead of the shared `WIND_CHARGE_HIT`, so the hit knows which one to turn. - `AbstractHurtingProjectile.applyInertia`: wind charges skipped it, so the power had no effect. They now run it with power 0 and inertia 1 in and out of water (`AbstractWindCharge`'s constructors, `getInertia`, `getLiquidInertia`), which leaves an unturned charge's speed exactly as it was. - A charge discarded earlier in the same tick is no longer a target (`canBeHitByProjectile`'s `isAlive`). Two gaps the harness ran into, fixed because it needs them: - `/summon minecraft:wind_charge` answered "Summoned" and made nothing, and saved charges were dropped on load: `fireball_from_nbt` and `persist.rs` now take both wind charges. - Selectors skipped wind charges: `@e[type=minecraft:wind_charge]` now finds them. Saving them back is not part of this: `fireball_to_nbt` still doesn't write them, so they don't survive a save and `/data get` has nothing to show for one. Scope is pearls hitting wind charges, as in #3599. Other projectiles (snowballs, eggs, arrows) and ghast fireballs as targets are still missing. Fixes #3299 ## 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 Read with `tools/rea_vanilla.py`, and `javap` for the lambda: `Projectile.onHit`, `onRedirectProjectile`, `deflect`, `setOwner`, `ProjectileDeflection.AIM_DEFLECT` (`lambda$static$2`), `AbstractHurtingProjectile.tick`, `applyInertia`, `onDeflection`, `AbstractWindCharge.<init>`, `getInertia`, `getLiquidInertia`, `canHitEntity`. Harness: `tools/test_pearl_wind_charge_parity.py`, on a vanilla and a Horizon dedicated server. A still charge is summoned above Alice, who throws a pearl straight up into it. It compares the height of her teleport to the block, and whether a second later the charge is in a band only a turned, accelerating charge reaches (35 to 47 blocks up by the numbers; a charge at speed 1 stops short). The pearl's inaccuracy is random, so x and z are not compared. Limits of what was checked: - The harness passed on the commit before the rebase onto current main. After the rebase I ran rustfmt, clippy and the touched unit tests only (`deflect::`, `projectiles::tests`, `entity_nbt`). - I did not run it against the unfixed code, so the band's power to fail on a charge without acceleration comes from the arithmetic above, not from a run. - The selector in the harness uses a wide `x,z,dx,dz` box on purpose: with only `y,dy`, vanilla found the charge and Horizon did not. I did not investigate that, and it looks like a separate selector gap. - `tools/port_ledger.py build` failed here (StopIteration, with `--jar`), so `port_ledger check` was not run. I did not run the decompile. - Not tried in a real game by a person yet. ## Self-check `--quick`, on the commit before the rebase. Harnesses run separately, one by one: `pearl_wind_charge` and `pearl_death` passed. **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on nixos, against upstream/main at b76ae35f5, 3 min 58 s) | Check | Result | | --- | --- | | Scope | ✅ 7 files, +224 −9 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ✅ 480 passed (32 s) | | rustfmt | ✅ (7 s) | | clippy | ✅ (23 s) | | tests: horizon-client | ✅ 965 passed (2 min 52 s) | | doc tests | ✅ 0 passed (2 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 | ➖ 355 affected, to run in CI (--quick) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:12:59 +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#5497
No description provided.