[PR #6356] [MERGED] Protection applies to generic damage on mobs #6822

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

📋 Pull Request Information

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

Base: main ← Head: fix/protection-generic


📝 Commits (3)

  • 212d78c Protection applies to generic damage on mobs
  • 2e16f1f Merge remote-tracking branch 'origin/main' into fix/protection-generic
  • 5c0086c Merge remote-tracking branch 'origin/main' into fix/protection-generic

📊 Changes

1 file changed (+6 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/mobs/gear.rs (+6 -3)

📄 Description

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

What and why

Enchantment protection (Protection, and the specialist ones where they apply) was skipped for plain generic damage on mobs. Vanilla's damage_protection effect is skipped only for damage in #bypasses_invulnerability (out_of_world, generic_kill), so generic (the /damage default, and the fallback for damage types without their own kind) is protected like any other type.

Changed: crates/horizon-client/src/mobs/gear.rs, one condition.

Fixes #6355

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

Enchantments minecraft:protection effect (minecraft:damage_protection, requirement: damage type not in #bypasses_invulnerability), DamageTypeTags.BYPASSES_INVULNERABILITY, EnchantmentHelper.getDamageProtection.

Test

protections_count_by_damage_kind (mobs/gear.rs) now expects Protection IV to count 4 points against generic and 0 against generic_kill and out_of_world. With the fix reverted it fails (left: 0.0, right: 4.0); with it, it passes.

Numbers

Side-by-side armour scene (vindicator, 24 HP, 4 pieces Protection IV diamond, 10 generic damage), health left:

vanilla Horizon before Horizon after
generic, diamond + Protection IV 20.4 14.0 20.4

The other damage types in the scene that were checked (mob_attack, arrow, explosion, magic, on_fire, fall, lava, cactus) did not change.

What wasn't compared

  • Only vindicators with Protection IV on generic; Blast/Fire/Projectile/Feather Falling against generic do not apply by their own rules and were not run.
  • The scene's later rows (resistance after the damage loop) still differ from vanilla on origin/main; that is Resistance on mobs, not this change.
  • Players are not covered.

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 4e0492a05, 5 min 36 s)

Check Result
Scope ✅ 2 files, +6 −3
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 16 s)
tests: horizon-client-lib ✅ 1261 passed (3 min 44 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/6356 **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/protection-generic` --- ### 📝 Commits (3) - [`212d78c`](https://github.com/horizon-rust/horizon/commit/212d78cced3d84ca00d6815ecdba6fc8fc3c1a78) Protection applies to generic damage on mobs - [`2e16f1f`](https://github.com/horizon-rust/horizon/commit/2e16f1ffdd494a551259db9d1c9a4b56fa0385e8) Merge remote-tracking branch 'origin/main' into fix/protection-generic - [`5c0086c`](https://github.com/horizon-rust/horizon/commit/5c0086ceb081eb4b12504497ff75492b42b90bfe) Merge remote-tracking branch 'origin/main' into fix/protection-generic ### 📊 Changes **1 file changed** (+6 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/gear.rs` (+6 -3) </details> ### 📄 Description > 🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself. ## What and why Enchantment protection (Protection, and the specialist ones where they apply) was skipped for plain `generic` damage on mobs. Vanilla's `damage_protection` effect is skipped only for damage in `#bypasses_invulnerability` (`out_of_world`, `generic_kill`), so `generic` (the `/damage` default, and the fallback for damage types without their own kind) is protected like any other type. Changed: `crates/horizon-client/src/mobs/gear.rs`, one condition. Fixes #6355 ## 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 `Enchantments` `minecraft:protection` effect (`minecraft:damage_protection`, requirement: damage type not in `#bypasses_invulnerability`), `DamageTypeTags.BYPASSES_INVULNERABILITY`, `EnchantmentHelper.getDamageProtection`. ## Test `protections_count_by_damage_kind` (`mobs/gear.rs`) now expects Protection IV to count 4 points against `generic` and 0 against `generic_kill` and `out_of_world`. With the fix reverted it fails (`left: 0.0, right: 4.0`); with it, it passes. ## Numbers Side-by-side `armour` scene (vindicator, 24 HP, 4 pieces Protection IV diamond, 10 `generic` damage), health left: | | vanilla | Horizon before | Horizon after | |---|---|---|---| | generic, diamond + Protection IV | 20.4 | 14.0 | 20.4 | The other damage types in the scene that were checked (mob_attack, arrow, explosion, magic, on_fire, fall, lava, cactus) did not change. ## What wasn't compared - Only vindicators with Protection IV on `generic`; Blast/Fire/Projectile/Feather Falling against `generic` do not apply by their own rules and were not run. - The scene's later rows (resistance after the damage loop) still differ from vanilla on origin/main; that is Resistance on mobs, not this change. - Players are not covered. 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 4e0492a05, 5 min 36 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +6 −3 | | 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 16 s) | | tests: horizon-client-lib | ✅ 1261 passed (3 min 44 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:34 +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#6822
No description provided.