[PR #2585] [MERGED] Mobs: foxes, rabbits, goats and horses keep their state #4448

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

📋 Pull Request Information

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

Base: main ← Head: fix/fox-rabbit-goat-fields


📝 Commits (2)

  • 6c716f4 Mobs: farm animals and frogs keep their variant; sound variants are saved
  • b1450f1 Mobs: foxes, rabbits, goats and horses keep their state

📊 Changes

4 files changed (+223 additions, -31 deletions)

View changed files

📝 crates/horizon-client/examples/probe/finalize_spawn_fixture.rs (+4 -4)
📝 crates/horizon-client/src/entity_nbt.rs (+204 -24)
📝 crates/horizon-client/src/mobs.rs (+3 -2)
📝 crates/horizon-client/src/mobs/finalize.rs (+12 -1)

📄 Description

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

What and why

Builds on #2541 (variants and sound variants); its commit is included here, so please review the last commit.

finalizeSpawn picks a fox's type, a rabbit's type, a goat's screaming flag and horns and a horse's max health, but the save and the load did not keep them:

  • a snow fox came back red, every rabbit came back brown (Type, RabbitType were neither written nor read);
  • a goat that had lost a horn grew it back (IsScreamingGoat, HasLeftHorn, HasRightHorn);
  • a new horse was saved with the type's health (53) above the max health it rolled (18 in the seed below).

What changes:

  • Fox, rabbit and goat save these fields from the model and read them back. An unknown rabbit type is brown (Rabbit.Variant.byId), horns default to present (getBooleanOr("HasLeftHorn", true)).
  • Fields Horizon does not model keep a loaded value or get vanilla's default: a fox's Trusted, Sleeping, Sitting, Crouching, a rabbit's MoreCarrotTicks, a horse's EatingHaystack and Bred.
  • A loaded horse or llama has its health clamped to its max health, as LivingEntity.setHealth does. The clamp is limited to them: the load reads only the max health's base, so a general clamp would cut a leader zombie's bonus.

Vanilla reference

  • Fox.add/readAdditionalSaveData, Rabbit.add/readAdditionalSaveData, Goat.add/readAdditionalSaveData, AbstractHorse.addAdditionalSaveData.
  • LivingEntity.readAdditionalSaveData → setHealth (clamped to getMaxHealth); a generated entity is saved and loaded once more by the proto chunk (ProtoChunk.addEntity, ChunkStatusTasks.postLoadProtoChunk).

Tests

  • New unit test entity_nbt::sheep_nbt_tests::foxes_rabbits_and_goats_keep_their_kind.
  • End to end, seed 8675309, 512 × 512 blocks with mob spawning on, compared with vanilla 26.3: foxes, rabbits, goats and horses now save the same fields as vanilla's. Before, the foxes lacked Type, Sleeping, Sitting, Trusted and Crouching, the rabbits RabbitType and MoreCarrotTicks, the goats their horn flags, and the horses had Health 53 where vanilla has 18.

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on e8709b51f471, against upstream/main at cb43e3278, 10 min 21 s)

Check Result
Scope ✅ 4 files, +223 −31
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 320 passed (31 s)
rustfmt ✅ (9 s)
clippy ✅ (2 min 27 s)
tests: horizon-client ✅ 1338 passed (5 min 31 s)
doc tests ✅ 0 passed (1 min 40 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 332 affected, to run in CI (--quick): arrow, attribute_map_queries, auto_jump, biome_source_codec, biome_temperature, biome_weather, biome_zoom, block_blob, block_collision_scan, block_column, block_entity_anim, block_entity_render and 320 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/2585 **Author:** [@FusselTV](https://github.com/FusselTV) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/fox-rabbit-goat-fields` --- ### 📝 Commits (2) - [`6c716f4`](https://github.com/horizon-rust/horizon/commit/6c716f457b7609e96bf6bc1642d0917cb615c1e4) Mobs: farm animals and frogs keep their variant; sound variants are saved - [`b1450f1`](https://github.com/horizon-rust/horizon/commit/b1450f1ef283e5f3902f43a775e080388ade2691) Mobs: foxes, rabbits, goats and horses keep their state ### 📊 Changes **4 files changed** (+223 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/probe/finalize_spawn_fixture.rs` (+4 -4) 📝 `crates/horizon-client/src/entity_nbt.rs` (+204 -24) 📝 `crates/horizon-client/src/mobs.rs` (+3 -2) 📝 `crates/horizon-client/src/mobs/finalize.rs` (+12 -1) </details> ### 📄 Description > 🤖 Opened by FusselTV's AI agent (Claude Code, Opus 5.5), not by FusselTV personally. ## What and why Builds on #2541 (variants and sound variants); its commit is included here, so please review the last commit. finalizeSpawn picks a fox's type, a rabbit's type, a goat's screaming flag and horns and a horse's max health, but the save and the load did not keep them: - a snow fox came back red, every rabbit came back brown (`Type`, `RabbitType` were neither written nor read); - a goat that had lost a horn grew it back (`IsScreamingGoat`, `HasLeftHorn`, `HasRightHorn`); - a new horse was saved with the type's health (53) above the max health it rolled (18 in the seed below). What changes: - Fox, rabbit and goat save these fields from the model and read them back. An unknown rabbit type is brown (`Rabbit.Variant.byId`), horns default to present (`getBooleanOr("HasLeftHorn", true)`). - Fields Horizon does not model keep a loaded value or get vanilla's default: a fox's `Trusted`, `Sleeping`, `Sitting`, `Crouching`, a rabbit's `MoreCarrotTicks`, a horse's `EatingHaystack` and `Bred`. - A loaded horse or llama has its health clamped to its max health, as `LivingEntity.setHealth` does. The clamp is limited to them: the load reads only the max health's base, so a general clamp would cut a leader zombie's bonus. ## Vanilla reference - `Fox.add/readAdditionalSaveData`, `Rabbit.add/readAdditionalSaveData`, `Goat.add/readAdditionalSaveData`, `AbstractHorse.addAdditionalSaveData`. - `LivingEntity.readAdditionalSaveData` → `setHealth` (clamped to `getMaxHealth`); a generated entity is saved and loaded once more by the proto chunk (`ProtoChunk.addEntity`, `ChunkStatusTasks.postLoadProtoChunk`). ## Tests - New unit test `entity_nbt::sheep_nbt_tests::foxes_rabbits_and_goats_keep_their_kind`. - End to end, seed 8675309, 512 × 512 blocks with mob spawning on, compared with vanilla 26.3: foxes, rabbits, goats and horses now save the same fields as vanilla's. Before, the foxes lacked `Type`, `Sleeping`, `Sitting`, `Trusted` and `Crouching`, the rabbits `RabbitType` and `MoreCarrotTicks`, the goats their horn flags, and the horses had `Health` 53 where vanilla has 18. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on e8709b51f471, against upstream/main at cb43e3278, 10 min 21 s) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +223 −31 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 320 passed (31 s) | | rustfmt | ✅ (9 s) | | clippy | ✅ (2 min 27 s) | | tests: horizon-client | ✅ 1338 passed (5 min 31 s) | | doc tests | ✅ 0 passed (1 min 40 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 332 affected, to run in CI (--quick): arrow, attribute_map_queries, auto_jump, biome_source_codec, biome_temperature, biome_weather, biome_zoom, block_blob, block_collision_scan, block_column, block_entity_anim, block_entity_render and 320 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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:17:13 +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#4448
No description provided.