[PR #1836] [MERGED] Read saved attribute bases for every mob #3802

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

📋 Pull Request Information

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

Base: main ← Head: fix/1483-mob-nbt-attributes


📝 Commits (2)

  • 13e83e4 Read saved attribute bases for every mob
  • 0dfc6d8 command_exec harness: summoned mobs' saved attribute bases and health (#1483)

📊 Changes

2 files changed (+31 additions, -8 deletions)

View changed files

📝 crates/horizon-client/src/entity_nbt.rs (+18 -8)
📝 tools/command_exec_corpus.py (+13 -0)

📄 Description

What and why

Fixes #1483.

/summon cow ~ ~ ~ {attributes:[{id:"minecraft:max_health",base:40.0d}]} gave a cow with 10 max health, because the attributes list was only read for horses and their relatives. Vanilla reads it for every living entity, then sets the health from Health, or to the max health when the tag has none.

Now mob_from_nbt reads the max_health, movement_speed and attack_damage bases (the three attributes mobs keep as plain values, the same ones /attribute edits) for every mob, before the health. Without a saved Health, the mob starts at its max health, so the summoned cow has 40 of 40. Horses still read jump_strength in their own branch.

Vanilla reference

  • LivingEntity.readAdditionalSaveData: applies the attributes list (AttributeMap.apply), then setHealth(input.getFloatOr("Health", getMaxHealth())).

No harness checks summon NBT attributes; I ran the existing harnesses that load mobs from NBT: python3 tools/parity.py -j 1 mob_ai world_reopen server_entities (3 passed). cargo check -p horizon-client is clean.

Self-check

pr_ready (tools/pr_ready.py --quick on device-591, against origin/main at e28b45376, 4 min 10 s)

Check Result
Scope ✅ 1 files, +18 −8
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (6 s)
clippy ✅ (15 s)
tests: horizon-client ✅ 1236 passed (3 min 44 s)
doc tests ✅ 0 passed (4 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 330 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 318 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🔄 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/1836 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/1483-mob-nbt-attributes` --- ### 📝 Commits (2) - [`13e83e4`](https://github.com/horizon-rust/horizon/commit/13e83e4e63e13752978d552980b997573013fea4) Read saved attribute bases for every mob - [`0dfc6d8`](https://github.com/horizon-rust/horizon/commit/0dfc6d8700554d0d0b8bfb93cc00cd14062daa49) command_exec harness: summoned mobs' saved attribute bases and health (#1483) ### 📊 Changes **2 files changed** (+31 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entity_nbt.rs` (+18 -8) 📝 `tools/command_exec_corpus.py` (+13 -0) </details> ### 📄 Description ## What and why Fixes #1483. `/summon cow ~ ~ ~ {attributes:[{id:"minecraft:max_health",base:40.0d}]}` gave a cow with 10 max health, because the `attributes` list was only read for horses and their relatives. Vanilla reads it for every living entity, then sets the health from `Health`, or to the max health when the tag has none. Now `mob_from_nbt` reads the `max_health`, `movement_speed` and `attack_damage` bases (the three attributes mobs keep as plain values, the same ones `/attribute` edits) for every mob, before the health. Without a saved `Health`, the mob starts at its max health, so the summoned cow has 40 of 40. Horses still read `jump_strength` in their own branch. ## Vanilla reference - `LivingEntity.readAdditionalSaveData`: applies the `attributes` list (`AttributeMap.apply`), then `setHealth(input.getFloatOr("Health", getMaxHealth()))`. No harness checks summon NBT attributes; I ran the existing harnesses that load mobs from NBT: `python3 tools/parity.py -j 1 mob_ai world_reopen server_entities` (3 passed). `cargo check -p horizon-client` is clean. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on device-591, against origin/main at e28b45376, 4 min 10 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +18 −8 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (6 s) | | clippy | ✅ (15 s) | | tests: horizon-client | ✅ 1236 passed (3 min 44 s) | | doc tests | ✅ 0 passed (4 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 330 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 318 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:12:24 +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#3802
No description provided.