[PR #2553] [MERGED] Save and load a mob's active effects #4421

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

📋 Pull Request Information

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

Base: main ← Head: fix/save-effects-teams


📝 Commits (3)

  • a68ee80 Save and load a mob's active effects, keep a player's hidden particles
  • 6c09ec2 Save a player effect's icon as shown only when its particles are
  • 54ab5dc Merge main into fix/save-effects-teams

📊 Changes

5 files changed (+77 additions, -28 deletions)

View changed files

📝 crates/horizon-client/src/brewing.rs (+24 -1)
📝 crates/horizon-client/src/effects.rs (+3 -2)
📝 crates/horizon-client/src/entity_nbt.rs (+44 -0)
📝 crates/horizon-client/src/game/commands/effects.rs (+1 -20)
📝 crates/horizon-client/src/save.rs (+5 -5)

📄 Description

What and why

A mob's active effects were not saved: mob_to_nbt never wrote active_effects and mob_from_nbt never read it, so effects given with /effect give were gone after a world reload. They are now written and read like vanilla. The effect id helper namespaced moves from the effect command into brewing so the save code can use it.

A player's effects had a smaller gap: show_particles was always written as on and the flag was read back from show_icon, so an effect given with hideParticles came back with particles. It is now written to and read from show_particles.

Scoreboard teams were checked too: scoreboard.dat is written on save and read on load, and teams with entity members round trip. Nothing needed changing there.

Vanilla reference

  • LivingEntity.addAdditionalSaveData / readAdditionalSaveData: active_effects, written only when there are effects.
  • MobEffectInstance.CODEC and Details.MAP_CODEC: id, amplifier, duration, ambient, show_particles, show_icon.

Self-check

cargo check -p horizon-client passes.


🔄 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/2553 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/save-effects-teams` --- ### 📝 Commits (3) - [`a68ee80`](https://github.com/horizon-rust/horizon/commit/a68ee8009f43ef692ecaac095218a1650db60585) Save and load a mob's active effects, keep a player's hidden particles - [`6c09ec2`](https://github.com/horizon-rust/horizon/commit/6c09ec2cc89febd655ff7eb414e8c1faf8c93df8) Save a player effect's icon as shown only when its particles are - [`54ab5dc`](https://github.com/horizon-rust/horizon/commit/54ab5dcf000067caa20acba2ad70a26c731c2adb) Merge main into fix/save-effects-teams ### 📊 Changes **5 files changed** (+77 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/brewing.rs` (+24 -1) 📝 `crates/horizon-client/src/effects.rs` (+3 -2) 📝 `crates/horizon-client/src/entity_nbt.rs` (+44 -0) 📝 `crates/horizon-client/src/game/commands/effects.rs` (+1 -20) 📝 `crates/horizon-client/src/save.rs` (+5 -5) </details> ### 📄 Description ## What and why A mob's active effects were not saved: `mob_to_nbt` never wrote `active_effects` and `mob_from_nbt` never read it, so effects given with `/effect give` were gone after a world reload. They are now written and read like vanilla. The effect id helper `namespaced` moves from the effect command into `brewing` so the save code can use it. A player's effects had a smaller gap: `show_particles` was always written as on and the flag was read back from `show_icon`, so an effect given with `hideParticles` came back with particles. It is now written to and read from `show_particles`. Scoreboard teams were checked too: `scoreboard.dat` is written on save and read on load, and teams with entity members round trip. Nothing needed changing there. ## Vanilla reference - `LivingEntity.addAdditionalSaveData` / `readAdditionalSaveData`: `active_effects`, written only when there are effects. - `MobEffectInstance.CODEC` and `Details.MAP_CODEC`: `id`, `amplifier`, `duration`, `ambient`, `show_particles`, `show_icon`. ## Self-check `cargo check -p horizon-client` passes. --- <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:02 +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#4421
No description provided.