[PR #6369] [MERGED] Mob effect NBT leaves out amplifier 0 #6828

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

📋 Pull Request Information

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

Base: main ← Head: fix/effect-amplifier-nbt


📝 Commits (2)

  • 1a89bbb Mob effect NBT leaves out amplifier 0
  • bfd6dc9 Merge remote-tracking branch 'origin/main' into fix/effect-amplifier-nbt

📊 Changes

1 file changed (+39 additions, -5 deletions)

View changed files

📝 crates/horizon-client/src/entity_nbt.rs (+39 -5)

📄 Description

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

What and why

A mob's saved effects wrote amplifier: 0b for level-1 effects. Vanilla's effect codec leaves the amplifier out when it is 0 (its default), so data get entity ... active_effects read differently. Horizon now omits it when 0 and still writes it otherwise; loading already treats a missing amplifier as 0.

Changed: crates/horizon-client/src/entity_nbt.rs.

Fixes #6367

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

MobEffectInstance codec (amplifier is an optional field, default 0), LivingEntity.addAdditionalSaveData (active_effects).

Test

an_amplifier_of_zero_is_left_out_of_active_effects (entity_nbt.rs): speed 0 saves without amplifier, slowness 2 with it, and both read back with the same levels. With the change reverted the first assertion fails; with it, it passes.

Numbers

Side-by-side effects scene, golem active_effects text, vanilla / before / after:
[{duration: 120, show_icon: 1b, id: "minecraft:poison"}] / same with amplifier: 0b added / identical to vanilla.
Lines mentioning amplifier in the diff output: 56 before, 0 after; values equal 902 -> 958 of 980. (The remaining 22 differences are the known mob effects covered elsewhere.)

What wasn't compared

  • Only mobs. The player's active_effects in playerdata is written by a different path and still writes amplifier, ambient and show_particles unconditionally; not compared.
  • ambient and show_particles defaults were already equal in the scene and are untouched.

Proved by script against the real 26.3 server; no human played this change.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick on Valhalla, against origin/main at e139ab2a3, 5 min 44 s)

Check Result
Scope ✅ 2 files, +39 −5
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 594 passed (25 s)
rustfmt ✅ (6 s)
Rust ⚠️ 1.98.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with rustup update
clippy ✅ (1 min 17 s)
tests: horizon-client-lib ✅ 1270 passed (3 min 50 s)
doc tests ✅ 0 passed (1 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 ➖ 336 affected, to run in CI (--quick): armor_stand_frost, arrow, arrow_wind_charge, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, block_tint, block_transformer, boat_authority and 324 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.ai/code/session_018zuDTsnyHkP28bzn3u7S3m


🔄 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/6369 **Author:** [@HrafnaValkyrja](https://github.com/HrafnaValkyrja) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/effect-amplifier-nbt` --- ### 📝 Commits (2) - [`1a89bbb`](https://github.com/horizon-rust/horizon/commit/1a89bbb7590c950e6399acea03e44959cc777e75) Mob effect NBT leaves out amplifier 0 - [`bfd6dc9`](https://github.com/horizon-rust/horizon/commit/bfd6dc917d2a5b2f4d2bbba5c0472b7bed265b79) Merge remote-tracking branch 'origin/main' into fix/effect-amplifier-nbt ### 📊 Changes **1 file changed** (+39 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entity_nbt.rs` (+39 -5) </details> ### 📄 Description > 🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself. ## What and why A mob's saved effects wrote `amplifier: 0b` for level-1 effects. Vanilla's effect codec leaves the amplifier out when it is 0 (its default), so `data get entity ... active_effects` read differently. Horizon now omits it when 0 and still writes it otherwise; loading already treats a missing amplifier as 0. Changed: `crates/horizon-client/src/entity_nbt.rs`. Fixes #6367 ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference `MobEffectInstance` codec (`amplifier` is an optional field, default 0), `LivingEntity.addAdditionalSaveData` (`active_effects`). ## Test `an_amplifier_of_zero_is_left_out_of_active_effects` (`entity_nbt.rs`): speed 0 saves without `amplifier`, slowness 2 with it, and both read back with the same levels. With the change reverted the first assertion fails; with it, it passes. ## Numbers Side-by-side `effects` scene, golem `active_effects` text, vanilla / before / after: `[{duration: 120, show_icon: 1b, id: "minecraft:poison"}]` / same with `amplifier: 0b` added / identical to vanilla. Lines mentioning `amplifier` in the diff output: 56 before, 0 after; values equal 902 -> 958 of 980. (The remaining 22 differences are the known mob effects covered elsewhere.) ## What wasn't compared - Only mobs. The player's `active_effects` in `playerdata` is written by a different path and still writes `amplifier`, `ambient` and `show_particles` unconditionally; not compared. - `ambient` and `show_particles` defaults were already equal in the scene and are untouched. Proved by script against the real 26.3 server; no human played this change. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on Valhalla, against origin/main at e139ab2a3, 5 min 44 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +39 −5 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 594 passed (25 s) | | rustfmt | ✅ (6 s) | | Rust | ⚠️ 1.98.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with `rustup update` | | clippy | ✅ (1 min 17 s) | | tests: horizon-client-lib | ✅ 1270 passed (3 min 50 s) | | doc tests | ✅ 0 passed (1 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 | ➖ 336 affected, to run in CI (--quick): armor_stand_frost, arrow, arrow_wind_charge, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, block_tint, block_transformer, boat_authority and 324 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) https://claude.ai/code/session_018zuDTsnyHkP28bzn3u7S3m --- <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:39 +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#6828
No description provided.