[PR #1685] [MERGED] Fireballs from NBT fly: /summon, chunk loads, selectors and /data get #3686

Closed
opened 2026-11-03 04:11:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1685
Author: @sdraeger
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/25/2026
Merged by: @ludovic111

Base: main ← Head: fix/nbt-fireballs


📝 Commits (2)

  • 4d3f3b6 Load fireballs from NBT as live projectiles
  • b7fcd44 Fireballs: LeftOwner and HasBeenShot are saved as Projectile writes them

📊 Changes

7 files changed (+166 additions, -40 deletions)

View changed files

📝 crates/horizon-client/src/entity_nbt.rs (+104 -0)
📝 crates/horizon-client/src/game/commands.rs (+21 -18)
📝 crates/horizon-client/src/game/commands/data.rs (+3 -2)
📝 crates/horizon-client/src/game/lan_entities.rs (+1 -14)
📝 crates/horizon-client/src/game/persist.rs (+11 -2)
📝 crates/horizon-client/src/game/scoreboard.rs (+1 -1)
📝 crates/horizon-client/src/projectiles.rs (+25 -3)

📄 Description

🤖 Opened by Simon's AI agent (Claude Code), not by Simon himself.

What and why

Fixes #1605. A fireball loaded from NBT (/summon, a chunk load) was kept as inert data in others. It now loads as a live Projectile, as arrows do. This follows @Domanffe's analysis on the issue: the loader alone would hide the fireball from selectors, so the same change makes it selectable.

 spawn_loaded_entities
   "minecraft:arrow"                         => arrow_from_nbt
+  "minecraft:fireball" | "small_fireball"   => fireball_from_nbt   # Motion, Rotation, Owner, LeftOwner,
+                                                                   # ExplosionPower, acceleration_power
 save (chunks)
-  arrow_to_nbt, else nothing                 # live fireballs were dropped
+  arrow_to_nbt or fireball_to_nbt, with the loaded UUID and raw keys (anon by the projectile's own kind)

 Target::Arrow(i)   →  Target::Projectile(i)  # already an index into creatures.projectiles
   selectors: arrows + fireballs (the kinds /data can write)
   type name: ProjectileKind::id()           # moved from lan_entities' match, shared
   /data get: arrow_to_nbt or fireball_to_nbt
   kill:      remove(i) (cmd_kill goes from the highest index down)

 Projectile
+  acceleration: f64 = 0.1                    # AbstractHurtingProjectile.accelerationPower, used by tick

Evidence

Default single player (server thread), horizon-ctl on a fresh world:

before (issue, and @Domanffe's branch) after
/summon fireball … {Motion:[0,0,1],acceleration_power:0}, Pos 1 s apart never changes z 4.8 → 14.5, Motion decays to 0.25 (inertia 0.95, no push)
same with the default power never changes Motion grows to 1.67 (toward 1.9)
execute if entity @e[type=minecraft:fireball] found only while inert Count: 1 per fireball
/data get … ExplosionPower / acceleration_power inert NBT 3b / 0.0d
fireball dropped onto stone nothing explodes; fireball gone, stone is air
stationary fireball, save, quit, reopen n/a still there with 5b, 0.0d
kill @e[type=minecraft:fireball] n/a Killed Fireball, count 0
summoned arrow (control) /data get works unchanged

The window's client tracks and draws a summoned fireball:
summoned fireball

python3 tools/parity.py command_exec save_roundtrip dispenser world_reopen: 4 passed. save_roundtrip caught a first version that gave the harness world's small fireball a new UUID on save; fixed by keeping loaded fireballs in the UUID memory (persist.anon) under their own kind.

Vanilla reference

AbstractHurtingProjectile.read/addAdditionalSaveData (acceleration_power), LargeFireball (ExplosionPower), Projectile (Owner, LeftOwner), keys read with javap on the 26.3 jar. Harnesses: save_roundtrip, world_reopen, command_exec, dispenser.

Not in this PR

  • Tags on projectiles: @e[tag=…] doesn't match arrows or fireballs (they keep no extra NBT), unchanged.
  • /data merge on projectiles still fails with commands.data.merge.failed, for arrows too.
  • Wither skulls, snowballs and the other kinds still load inert; each needs its own *_from_nbt.
  • On a LAN or dedicated server, lan/entity.rs still sends a fixed 0.1 acceleration to clients, so a client predicts a custom-power fireball slightly off between position updates.

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on Simons-MacBook-Pro, against upstream/main at 76638aaf8, 19 s)

Check Result
Scope ✅ 7 files, +153 −40
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (3 s)
clippy ✅ (2 s)
tests: horizon-client ✅ 1200 passed (13 s)
doc tests ✅ 0 passed (1 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Merge danger

Door: two-way. Blast radius: worlds with saved fireballs (they now fly on load, as in vanilla) and commands that select projectiles. /kill on arrows now removes by index instead of flagging; same result.

🤖 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/1685 **Author:** [@sdraeger](https://github.com/sdraeger) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/nbt-fireballs` --- ### 📝 Commits (2) - [`4d3f3b6`](https://github.com/horizon-rust/horizon/commit/4d3f3b639183a2550713c818b862fd9d6b4d57bd) Load fireballs from NBT as live projectiles - [`b7fcd44`](https://github.com/horizon-rust/horizon/commit/b7fcd446b6eed116764021d0c13e20e795a63b3c) Fireballs: LeftOwner and HasBeenShot are saved as Projectile writes them ### 📊 Changes **7 files changed** (+166 additions, -40 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entity_nbt.rs` (+104 -0) 📝 `crates/horizon-client/src/game/commands.rs` (+21 -18) 📝 `crates/horizon-client/src/game/commands/data.rs` (+3 -2) 📝 `crates/horizon-client/src/game/lan_entities.rs` (+1 -14) 📝 `crates/horizon-client/src/game/persist.rs` (+11 -2) 📝 `crates/horizon-client/src/game/scoreboard.rs` (+1 -1) 📝 `crates/horizon-client/src/projectiles.rs` (+25 -3) </details> ### 📄 Description > 🤖 Opened by Simon's AI agent (Claude Code), not by Simon himself. ## What and why Fixes #1605. A fireball loaded from NBT (`/summon`, a chunk load) was kept as inert data in `others`. It now loads as a live `Projectile`, as arrows do. This follows @Domanffe's analysis on the issue: the loader alone would hide the fireball from selectors, so the same change makes it selectable. ```diff spawn_loaded_entities "minecraft:arrow" => arrow_from_nbt + "minecraft:fireball" | "small_fireball" => fireball_from_nbt # Motion, Rotation, Owner, LeftOwner, + # ExplosionPower, acceleration_power save (chunks) - arrow_to_nbt, else nothing # live fireballs were dropped + arrow_to_nbt or fireball_to_nbt, with the loaded UUID and raw keys (anon by the projectile's own kind) Target::Arrow(i) → Target::Projectile(i) # already an index into creatures.projectiles selectors: arrows + fireballs (the kinds /data can write) type name: ProjectileKind::id() # moved from lan_entities' match, shared /data get: arrow_to_nbt or fireball_to_nbt kill: remove(i) (cmd_kill goes from the highest index down) Projectile + acceleration: f64 = 0.1 # AbstractHurtingProjectile.accelerationPower, used by tick ``` ## Evidence Default single player (server thread), `horizon-ctl` on a fresh world: | | before (issue, and @Domanffe's branch) | after | |---|---|---| | `/summon fireball … {Motion:[0,0,1],acceleration_power:0}`, `Pos` 1 s apart | never changes | z 4.8 → 14.5, Motion decays to 0.25 (inertia 0.95, no push) | | same with the default power | never changes | Motion grows to 1.67 (toward 1.9) | | `execute if entity @e[type=minecraft:fireball]` | found only while inert | `Count: 1` per fireball | | `/data get … ExplosionPower` / `acceleration_power` | inert NBT | `3b` / `0.0d` | | fireball dropped onto stone | nothing | explodes; fireball gone, stone is air | | stationary fireball, save, quit, reopen | n/a | still there with `5b`, `0.0d` | | `kill @e[type=minecraft:fireball]` | n/a | `Killed Fireball`, count 0 | | summoned arrow (control) | `/data get` works | unchanged | The window's client tracks and draws a summoned fireball: ![summoned fireball](https://raw.githubusercontent.com/sdraeger/horizon/pr-assets/fireball-visible.png) `python3 tools/parity.py command_exec save_roundtrip dispenser world_reopen`: 4 passed. `save_roundtrip` caught a first version that gave the harness world's small fireball a new UUID on save; fixed by keeping loaded fireballs in the UUID memory (`persist.anon`) under their own kind. ## Vanilla reference `AbstractHurtingProjectile.read/addAdditionalSaveData` (`acceleration_power`), `LargeFireball` (`ExplosionPower`), `Projectile` (`Owner`, `LeftOwner`), keys read with `javap` on the 26.3 jar. Harnesses: `save_roundtrip`, `world_reopen`, `command_exec`, `dispenser`. ## Not in this PR - Tags on projectiles: `@e[tag=…]` doesn't match arrows or fireballs (they keep no extra NBT), unchanged. - `/data merge` on projectiles still fails with `commands.data.merge.failed`, for arrows too. - Wither skulls, snowballs and the other kinds still load inert; each needs its own `*_from_nbt`. - On a LAN or dedicated server, `lan/entity.rs` still sends a fixed 0.1 acceleration to clients, so a client predicts a custom-power fireball slightly off between position updates. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on Simons-MacBook-Pro, against upstream/main at 76638aaf8, 19 s) | Check | Result | | --- | --- | | Scope | ✅ 7 files, +153 −40 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (3 s) | | clippy | ✅ (2 s) | | tests: horizon-client | ✅ 1200 passed (13 s) | | doc tests | ✅ 0 passed (1 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | ## Merge danger **Door:** two-way. **Blast radius:** worlds with saved fireballs (they now fly on load, as in vanilla) and commands that select projectiles. `/kill` on arrows now removes by index instead of flagging; same result. 🤖 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 04:11:25 +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#3686
No description provided.