[PR #2821] [MERGED] The death message names the cause's item when it has a custom name #4638

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2821
Author: @levzzz5154
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @ludovic111

Base: main ← Head: fix/death-message-item-name


📝 Commits (8)

  • f9ca0a7 The death message names the cause's item when it has a custom name
  • c001f56 Merge current main before death-message review fixes
  • ace27c1 Keep named held stacks current and use full death-message display names
  • 7d0e5aa Do not save replaced main-hand components from the raw entity
  • c6dfae6 Keep live enchantments when displaying and saving named equipment
  • 69689b3 Cover named equipment replacement through save and reload
  • 6534db4 Specify the equipment regression fixture's mob registry type
  • a11e54e Merge main into the branch

📊 Changes

25 files changed (+234 additions, -65 deletions)

View changed files

📝 crates/horizon-client-core/src/scoreboard.rs (+46 -0)
📝 crates/horizon-client/examples/probe/entity_anim_fixture.rs (+3 -3)
📝 crates/horizon-client/examples/probe/entity_death_loot_fixture.rs (+1 -1)
📝 crates/horizon-client/src/entity_nbt.rs (+67 -9)
📝 crates/horizon-client/src/game/allays.rs (+1 -1)
📝 crates/horizon-client/src/game/combat.rs (+20 -2)
📝 crates/horizon-client/src/game/commands/items.rs (+2 -2)
📝 crates/horizon-client/src/game/dispenser.rs (+1 -1)
📝 crates/horizon-client/src/game/lan.rs (+2 -5)
📝 crates/horizon-client/src/game/mob_gear.rs (+2 -2)
📝 crates/horizon-client/src/game/passengers.rs (+4 -3)
📝 crates/horizon-client/src/game/perspective.rs (+2 -4)
📝 crates/horizon-client/src/game/remote.rs (+1 -1)
📝 crates/horizon-client/src/game/zombie_villagers.rs (+4 -1)
📝 crates/horizon-client/src/mobs.rs (+46 -0)
📝 crates/horizon-client/src/mobs/drops.rs (+1 -1)
📝 crates/horizon-client/src/mobs/finalize.rs (+1 -1)
📝 crates/horizon-client/src/mobs/fox.rs (+8 -6)
📝 crates/horizon-client/src/mobs/illusioner.rs (+1 -1)
📝 crates/horizon-client/src/mobs/spawning.rs (+13 -13)

...and 5 more files

📄 Description

🤖 Opened by levzzz5154's AI agent (OpenAI Codex), not by levzzz5154 himself.

When a mob kills a player while holding a custom-named item, use vanilla's item-specific death message and pass the complete item display component: brackets, custom-name italics, rarity colour and item hover.

The caller now uses Game::stack_display_name. Named equipment retains its full held stack, and all existing main-hand replacement/take paths clear or replace that stack, including replacement with the same item ID. Equipment commands and player-model synchronization retain the new stack's components. Saving cannot bring back components from a replaced raw item, and live equipment enchantments remain reflected in the saved/displayed stack.

Fixes #2802.

Vanilla reference: DamageSource.getLocalizedDeathMessage, ItemStack.getDisplayName, and DataComponents.CUSTOM_NAME. Regression coverage includes replacing a named held item with the same item ID and taking it out of the hand.

Control-socket runtime proof passed in both server-thread and legacy modes: a zombie loaded with a named sword produces using [Old Sword]; replacing it with an unnamed sword of the same type removes the item suffix; replacing it with a newly named sword produces using [New Sword]. The save/reload regression checks that old raw equipment components cannot restore the replaced name.

pr_ready (tools/pr_ready.py --quick --base hr/main on cachyos-x8664, against hr/main at d203ca04b, 4 min 8 s)

Check Result
Scope ✅ 25 files, +234 −65
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 408 passed (30 s)
rustfmt ✅ (6 s)
clippy ✅ (22 s)
tests: horizon-client, horizon-client-core ✅ 841 passed (2 min 56 s)
doc tests ✅ 0 passed (9 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 ➖ 68 affected, to run in CI (--quick): arrow, block_removal, cauldron, chat_screen, command_exec, command_parse, composter, crafter, cursor_death, dedicated_server, dispenser, entity_components and 56 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Validation used Rust stable 1.99.1 and an isolated Cargo target directory with prepared resources.

🤖 Generated with OpenAI Codex.


🔄 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/2821 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/death-message-item-name` --- ### 📝 Commits (8) - [`f9ca0a7`](https://github.com/horizon-rust/horizon/commit/f9ca0a76cf97fef6a2ab5b080ffec421e0b3593f) The death message names the cause's item when it has a custom name - [`c001f56`](https://github.com/horizon-rust/horizon/commit/c001f56d0fc197523d896ce8cb326c8f4f68bb52) Merge current main before death-message review fixes - [`ace27c1`](https://github.com/horizon-rust/horizon/commit/ace27c11a97ef539570f4ca48baf159e77bb3c62) Keep named held stacks current and use full death-message display names - [`7d0e5aa`](https://github.com/horizon-rust/horizon/commit/7d0e5aa95349e22f18f1eae1426f0c788edd7b65) Do not save replaced main-hand components from the raw entity - [`c6dfae6`](https://github.com/horizon-rust/horizon/commit/c6dfae6dd7804a887d96105a9b7fdbd7f1a0d9f1) Keep live enchantments when displaying and saving named equipment - [`69689b3`](https://github.com/horizon-rust/horizon/commit/69689b3fdd4313bfe0d31d7d496d8e2ab7dea072) Cover named equipment replacement through save and reload - [`6534db4`](https://github.com/horizon-rust/horizon/commit/6534db4f6dd4666f338c25bf8a436d419b703d8c) Specify the equipment regression fixture's mob registry type - [`a11e54e`](https://github.com/horizon-rust/horizon/commit/a11e54e7b8bf4fd1acfdf6f796ebd7a772f313d3) Merge main into the branch ### 📊 Changes **25 files changed** (+234 additions, -65 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-core/src/scoreboard.rs` (+46 -0) 📝 `crates/horizon-client/examples/probe/entity_anim_fixture.rs` (+3 -3) 📝 `crates/horizon-client/examples/probe/entity_death_loot_fixture.rs` (+1 -1) 📝 `crates/horizon-client/src/entity_nbt.rs` (+67 -9) 📝 `crates/horizon-client/src/game/allays.rs` (+1 -1) 📝 `crates/horizon-client/src/game/combat.rs` (+20 -2) 📝 `crates/horizon-client/src/game/commands/items.rs` (+2 -2) 📝 `crates/horizon-client/src/game/dispenser.rs` (+1 -1) 📝 `crates/horizon-client/src/game/lan.rs` (+2 -5) 📝 `crates/horizon-client/src/game/mob_gear.rs` (+2 -2) 📝 `crates/horizon-client/src/game/passengers.rs` (+4 -3) 📝 `crates/horizon-client/src/game/perspective.rs` (+2 -4) 📝 `crates/horizon-client/src/game/remote.rs` (+1 -1) 📝 `crates/horizon-client/src/game/zombie_villagers.rs` (+4 -1) 📝 `crates/horizon-client/src/mobs.rs` (+46 -0) 📝 `crates/horizon-client/src/mobs/drops.rs` (+1 -1) 📝 `crates/horizon-client/src/mobs/finalize.rs` (+1 -1) 📝 `crates/horizon-client/src/mobs/fox.rs` (+8 -6) 📝 `crates/horizon-client/src/mobs/illusioner.rs` (+1 -1) 📝 `crates/horizon-client/src/mobs/spawning.rs` (+13 -13) _...and 5 more files_ </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (OpenAI Codex), not by levzzz5154 himself. When a mob kills a player while holding a custom-named item, use vanilla's item-specific death message and pass the complete item display component: brackets, custom-name italics, rarity colour and item hover. The caller now uses `Game::stack_display_name`. Named equipment retains its full held stack, and all existing main-hand replacement/take paths clear or replace that stack, including replacement with the same item ID. Equipment commands and player-model synchronization retain the new stack's components. Saving cannot bring back components from a replaced raw item, and live equipment enchantments remain reflected in the saved/displayed stack. Fixes #2802. Vanilla reference: `DamageSource.getLocalizedDeathMessage`, `ItemStack.getDisplayName`, and `DataComponents.CUSTOM_NAME`. Regression coverage includes replacing a named held item with the same item ID and taking it out of the hand. Control-socket runtime proof passed in both server-thread and legacy modes: a zombie loaded with a named sword produces `using [Old Sword]`; replacing it with an unnamed sword of the same type removes the item suffix; replacing it with a newly named sword produces `using [New Sword]`. The save/reload regression checks that old raw equipment components cannot restore the replaced name. **pr_ready** (`tools/pr_ready.py --quick --base hr/main` on cachyos-x8664, against hr/main at d203ca04b, 4 min 8 s) | Check | Result | | --- | --- | | Scope | ✅ 25 files, +234 −65 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 408 passed (30 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (22 s) | | tests: horizon-client, horizon-client-core | ✅ 841 passed (2 min 56 s) | | doc tests | ✅ 0 passed (9 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 | ➖ 68 affected, to run in CI (--quick): arrow, block_removal, cauldron, chat_screen, command_exec, command_parse, composter, crafter, cursor_death, dedicated_server, dispenser, entity_components and 56 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Validation used Rust stable 1.99.1 and an isolated Cargo target directory with prepared resources. 🤖 Generated with [OpenAI Codex](https://openai.com/codex/). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:06:50 +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#4638
No description provided.