[PR #6614] [MERGED] A saved fireball carries its Item, as vanilla's Fireball does #6984

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

📋 Pull Request Information

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

Base: main ← Head: fix/6594-fireball-item


📝 Commits (3)

  • 9de27c4 A saved fireball carries its Item, as vanilla's Fireball does
  • b0b5c25 Merge origin/main into fix/6594-fireball-item
  • ab3ed2d Merge origin/main into fix/6594-fireball-item

📊 Changes

3 files changed (+79 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/entity_nbt.rs (+69 -0)
📝 crates/horizon-client/src/game/persist.rs (+8 -2)
📝 docs/server.md (+2 -1)

📄 Description

🤖 Opened by both Akirabane's AI agent (Claude Code), and Akirabane Himself after his review.

Fixes #6594

What was wrong

Fireball.addAdditionalSaveData always writes Item (a fire charge by default) and readAdditionalSaveData reads it back through setItem, which refuses an empty stack and keeps a single one (read with javap on the 26.3 server jar). Fireball is the parent of LargeFireball (minecraft:fireball) and SmallFireball, not of the wind charges. fireball_to_nbt wrote only the flight, so a saved fireball and a /data get entity had no Item.

A second thing showed while checking it in the game: for a projectile Horizon keeps only the loaded Tags (remember_tags), so a loaded Item was dropped for the thrown items too. throwable_to_nbt says "the loaded item stays (a blue egg's, a renamed one's)" but never saw it.

What changed

  • entity_nbt.rs: fireball_to_nbt writes Item for the large and the small fireball: the loaded item as a single one, or a fire charge when there is none or it is empty (air). The wind charges save none.
  • game/persist.rs: remember_tags keeps a loaded Item beside the Tags, which is what lets the fireballs (and throwable_to_nbt, as its comment intends) write back what they were loaded with.
  • docs/server.md: the RCON paragraph still said the command goes to the game as console <line>; since #6443 it is an rcon <line> request.

Not in this change: drawing a custom item in place of the fire charge (the renderer keeps the fire charge).

How it was checked

Unit test a_fireball_saves_its_item: both fireballs save a fire charge by default, a loaded diamond stack of five stays as one diamond, an air item falls back to the fire charge, and a wind charge saves none.

In the game (horizon-ctl launch --offscreen, creative world), /summon then /data get entity ... Item, before this change (a build of main from the evening) and after:

Summoned Before After
fireball, small_fireball (no Item) no Item fire_charge, count 1
fireball with Item:{id:"minecraft:diamond",count:5} no Item diamond, count 1
small_fireball with Item:{id:"minecraft:air",count:1} no Item fire_charge, count 1
snowball with Item:{id:"minecraft:egg",count:1} snowball (the egg was lost) egg

Self-check

tools/pr_ready.py --quick --base origin/main:

Check Result
Scope 3 files, +79 −3
Cargo.lock unchanged
rustfmt ✅
clippy ✅
tests: horizon-client, horizon-client-lib 588 passed, 2 failed: native_hooks::native_breathing_stays_hookable and native_loot_kinds_stay_hookable read a source file with LF line endings; they fail the same way on my Windows checkout without this change
Python tests 2 errors: test_port_ledger (a global tests package shadows the repo's on my machine) and test_world_input_capture, neither touched here
Parity not run (--quick): the CI parity job picks the affected harnesses

Label: a fix, no feature label.


🔄 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/6614 **Author:** [@Akirabane](https://github.com/Akirabane) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/6594-fireball-item` --- ### 📝 Commits (3) - [`9de27c4`](https://github.com/horizon-rust/horizon/commit/9de27c4e08824668e7557d7d90394ab501d9a751) A saved fireball carries its Item, as vanilla's Fireball does - [`b0b5c25`](https://github.com/horizon-rust/horizon/commit/b0b5c25998c69b32e5f6d805905504ac3ad0d8ee) Merge origin/main into fix/6594-fireball-item - [`ab3ed2d`](https://github.com/horizon-rust/horizon/commit/ab3ed2d7e8ac6d5b11afa5679331fcf09c89643e) Merge origin/main into fix/6594-fireball-item ### 📊 Changes **3 files changed** (+79 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entity_nbt.rs` (+69 -0) 📝 `crates/horizon-client/src/game/persist.rs` (+8 -2) 📝 `docs/server.md` (+2 -1) </details> ### 📄 Description > 🤖 Opened by both Akirabane's AI agent (Claude Code), and Akirabane Himself after his review. Fixes #6594 ## What was wrong `Fireball.addAdditionalSaveData` always writes `Item` (a fire charge by default) and `readAdditionalSaveData` reads it back through `setItem`, which refuses an empty stack and keeps a single one (read with `javap` on the 26.3 server jar). `Fireball` is the parent of `LargeFireball` (`minecraft:fireball`) and `SmallFireball`, not of the wind charges. `fireball_to_nbt` wrote only the flight, so a saved fireball and a `/data get entity` had no `Item`. A second thing showed while checking it in the game: for a projectile Horizon keeps only the loaded `Tags` (`remember_tags`), so a loaded `Item` was dropped for the thrown items too. `throwable_to_nbt` says "the loaded item stays (a blue egg's, a renamed one's)" but never saw it. ## What changed - `entity_nbt.rs`: `fireball_to_nbt` writes `Item` for the large and the small fireball: the loaded item as a single one, or a fire charge when there is none or it is empty (`air`). The wind charges save none. - `game/persist.rs`: `remember_tags` keeps a loaded `Item` beside the `Tags`, which is what lets the fireballs (and `throwable_to_nbt`, as its comment intends) write back what they were loaded with. - `docs/server.md`: the RCON paragraph still said the command goes to the game as `console <line>`; since #6443 it is an `rcon <line>` request. Not in this change: drawing a custom item in place of the fire charge (the renderer keeps the fire charge). ## How it was checked Unit test `a_fireball_saves_its_item`: both fireballs save a fire charge by default, a loaded diamond stack of five stays as one diamond, an `air` item falls back to the fire charge, and a wind charge saves none. In the game (`horizon-ctl launch --offscreen`, creative world), `/summon` then `/data get entity ... Item`, before this change (a build of main from the evening) and after: | Summoned | Before | After | | --- | --- | --- | | `fireball`, `small_fireball` (no `Item`) | no `Item` | `fire_charge`, count 1 | | `fireball` with `Item:{id:"minecraft:diamond",count:5}` | no `Item` | `diamond`, count 1 | | `small_fireball` with `Item:{id:"minecraft:air",count:1}` | no `Item` | `fire_charge`, count 1 | | `snowball` with `Item:{id:"minecraft:egg",count:1}` | `snowball` (the egg was lost) | `egg` | ## Self-check `tools/pr_ready.py --quick --base origin/main`: | Check | Result | | --- | --- | | Scope | 3 files, +79 −3 | | Cargo.lock | unchanged | | rustfmt | ✅ | | clippy | ✅ | | tests: horizon-client, horizon-client-lib | 588 passed, 2 failed: `native_hooks::native_breathing_stays_hookable` and `native_loot_kinds_stay_hookable` read a source file with LF line endings; they fail the same way on my Windows checkout without this change | | Python tests | 2 errors: `test_port_ledger` (a global `tests` package shadows the repo's on my machine) and `test_world_input_capture`, neither touched here | | Parity | not run (`--quick`): the CI parity job picks the affected harnesses | Label: a fix, no `feature` label. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:30:46 +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#6984
No description provided.