[PR #6387] [MERGED] Save a dolphin's fish and moistness #6837

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

📋 Pull Request Information

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

Base: main ← Head: fix/dolphin-save


📝 Commits (1)

  • 82de324 Save a dolphin's fish and moistness

📊 Changes

2 files changed (+56 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/entity_nbt.rs (+54 -0)
📝 crates/horizon-client/src/mobs/aquatic.rs (+2 -0)

📄 Description

Dolphin.addAdditionalSaveData writes two fields of its own:

// javap -p -c on Dolphin
 6: ldc "GotFish";   9: invokevirtual gotFish;             12: ValueOutput.putBoolean
18: ldc "Moistness"; 21: invokevirtual getMoistnessLevel;  24: ValueOutput.putInt

and readAdditionalSaveData reads them with getBooleanOr("GotFish", false) and
getIntOr("Moistness", 2400).

Horizon models both - extra.flag is gotFish and extra.counter is the moistness that
aquatic::tick refills in water or rain and drains on land - but neither reached the save, so a
dolphin that was fed forgot it, and one saved wet came back at zero moistness and started taking
dry-out damage as soon as it was loaded outside water. The constructor also never set the field
to its default, so a fresh dolphin started at zero rather than 2400.

Proven: on the build VM, cargo test -q -p horizon-client-lib --lib a_dolphins_moistness
→ 1 passed: a fresh dolphin starts at 2400, a fed one at 123 round-trips with GotFish,
and a save naming neither field reads back as an unfed dolphin at 2400.

Not proven: not checked in game; the check is feeding a dolphin, letting it start to dry on
land, saving and reloading, and seeing it still fed and still wet.

One thing left alone here: aquatic::tick damages a dried-out dolphin with Drown where vanilla
uses dry_out (the death message differs), and its hop on land uses a 0.5 upward push where
vanilla adds 0.1. Both are separate from the save and are not touched by this change.


🔄 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/6387 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/dolphin-save` --- ### 📝 Commits (1) - [`82de324`](https://github.com/horizon-rust/horizon/commit/82de324266c0e55cd49cd8d5f83b479b2415777a) Save a dolphin's fish and moistness ### 📊 Changes **2 files changed** (+56 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entity_nbt.rs` (+54 -0) 📝 `crates/horizon-client/src/mobs/aquatic.rs` (+2 -0) </details> ### 📄 Description `Dolphin.addAdditionalSaveData` writes two fields of its own: ```java // javap -p -c on Dolphin 6: ldc "GotFish"; 9: invokevirtual gotFish; 12: ValueOutput.putBoolean 18: ldc "Moistness"; 21: invokevirtual getMoistnessLevel; 24: ValueOutput.putInt ``` and `readAdditionalSaveData` reads them with `getBooleanOr("GotFish", false)` and `getIntOr("Moistness", 2400)`. Horizon models both - `extra.flag` is `gotFish` and `extra.counter` is the moistness that `aquatic::tick` refills in water or rain and drains on land - but neither reached the save, so a dolphin that was fed forgot it, and one saved wet came back at zero moistness and started taking dry-out damage as soon as it was loaded outside water. The constructor also never set the field to its default, so a fresh dolphin started at zero rather than 2400. **Proven:** on the build VM, `cargo test -q -p horizon-client-lib --lib a_dolphins_moistness` → `1 passed`: a fresh dolphin starts at 2400, a fed one at 123 round-trips with `GotFish`, and a save naming neither field reads back as an unfed dolphin at 2400. **Not proven:** not checked in game; the check is feeding a dolphin, letting it start to dry on land, saving and reloading, and seeing it still fed and still wet. One thing left alone here: `aquatic::tick` damages a dried-out dolphin with `Drown` where vanilla uses `dry_out` (the death message differs), and its hop on land uses a 0.5 upward push where vanilla adds 0.1. Both are separate from the save and are not touched by this change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:27:48 +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#6837
No description provided.