[PR #2157] [MERGED] Wear armor from environment damage (cactus, fire, lava, campfire, berry bushes) #4058

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

📋 Pull Request Information

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

Base: main ← Head: fix/armor-wear-environment-damage


📝 Commits (2)

  • b752a82 Wear armor when cactus, fire, lava, campfires and other environment damage hurt the player
  • dae701a Merge main into fix/armor-wear-environment-damage

📊 Changes

9 files changed (+73 additions, -28 deletions)

View changed files

📝 crates/horizon-client/examples/probe/scene_motion_probe.rs (+2 -0)
📝 crates/horizon-client/src/game.rs (+46 -6)
📝 crates/horizon-client/src/game/creatures.rs (+0 -1)
📝 crates/horizon-client/src/game/explosion.rs (+0 -3)
📝 crates/horizon-client/src/game/falling_damage.rs (+2 -8)
📝 crates/horizon-client/src/game/fireworks.rs (+2 -8)
📝 crates/horizon-client/src/game/lan_actions.rs (+1 -0)
📝 crates/horizon-client/src/health.rs (+14 -2)
📝 crates/horizon-client/src/items.rs (+6 -0)

📄 Description

What and why

Armor lost no durability from cactus, campfires, magma blocks, lava, fire, sweet berry bushes and other environment damage. It only wore from mob hits, explosions, falling blocks and fireworks, because those paths called the armor wear by hand while the shared damage pipeline's armor step was an empty stub.

Now the pipeline's armor step raises an event and the game wears the armor from it, so every hit that goes through the pipeline wears armor the same way, for the local player and for players on a server:

  • Each worn piece loses max(1, damage / 4) durability, with Unbreaking applied.
  • Damage in #minecraft:bypasses_armor (on fire, drowning, starving, falling, magic, wither and so on) wears nothing. This also fixes mob hits of those types, such as evoker fangs (indirect_magic), which used to wear armor.
  • Pieces with damage_on_hurt: false (the elytra) are not worn by hits, which used to happen on mob hits.
  • Pieces that resist fire (netherite) are not worn by fire damage.

The hand-written wear calls for mob hits, explosions, falling blocks and fireworks are removed, so those are not worn twice. They now use the damage amount the pipeline sees (after a shield, for example). The event is skipped in the scene motion probe, since its oracle player wears no armor.

Vanilla reference

  • LivingEntity.getDamageAfterArmorAbsorb: calls hurtArmor(source, damage) unless the source is in #bypasses_armor.
  • Player.hurtArmor -> LivingEntity.doHurtEquipment: (int) Math.max(1.0F, damage / 4.0F) for each of feet, legs, chest, head, when the item is equippable with damageOnHurt, damageable, and ItemStack.canBeHurtBy(source).
  • data/minecraft/tags/damage_type/bypasses_armor.json and is_fire.json; Items.ELYTRA sets setDamageOnHurt(false).

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/2157 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/armor-wear-environment-damage` --- ### 📝 Commits (2) - [`b752a82`](https://github.com/horizon-rust/horizon/commit/b752a821b1f501b78cdf200362ecd9975e277ad7) Wear armor when cactus, fire, lava, campfires and other environment damage hurt the player - [`dae701a`](https://github.com/horizon-rust/horizon/commit/dae701a3c76bb83f98a7bad61dfc4a5a79123942) Merge main into fix/armor-wear-environment-damage ### 📊 Changes **9 files changed** (+73 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/probe/scene_motion_probe.rs` (+2 -0) 📝 `crates/horizon-client/src/game.rs` (+46 -6) 📝 `crates/horizon-client/src/game/creatures.rs` (+0 -1) 📝 `crates/horizon-client/src/game/explosion.rs` (+0 -3) 📝 `crates/horizon-client/src/game/falling_damage.rs` (+2 -8) 📝 `crates/horizon-client/src/game/fireworks.rs` (+2 -8) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+1 -0) 📝 `crates/horizon-client/src/health.rs` (+14 -2) 📝 `crates/horizon-client/src/items.rs` (+6 -0) </details> ### 📄 Description ## What and why Armor lost no durability from cactus, campfires, magma blocks, lava, fire, sweet berry bushes and other environment damage. It only wore from mob hits, explosions, falling blocks and fireworks, because those paths called the armor wear by hand while the shared damage pipeline's armor step was an empty stub. Now the pipeline's armor step raises an event and the game wears the armor from it, so every hit that goes through the pipeline wears armor the same way, for the local player and for players on a server: - Each worn piece loses `max(1, damage / 4)` durability, with Unbreaking applied. - Damage in `#minecraft:bypasses_armor` (on fire, drowning, starving, falling, magic, wither and so on) wears nothing. This also fixes mob hits of those types, such as evoker fangs (`indirect_magic`), which used to wear armor. - Pieces with `damage_on_hurt: false` (the elytra) are not worn by hits, which used to happen on mob hits. - Pieces that resist fire (netherite) are not worn by fire damage. The hand-written wear calls for mob hits, explosions, falling blocks and fireworks are removed, so those are not worn twice. They now use the damage amount the pipeline sees (after a shield, for example). The event is skipped in the scene motion probe, since its oracle player wears no armor. ## Vanilla reference - `LivingEntity.getDamageAfterArmorAbsorb`: calls `hurtArmor(source, damage)` unless the source is in `#bypasses_armor`. - `Player.hurtArmor` -> `LivingEntity.doHurtEquipment`: `(int) Math.max(1.0F, damage / 4.0F)` for each of feet, legs, chest, head, when the item is `equippable` with `damageOnHurt`, damageable, and `ItemStack.canBeHurtBy(source)`. - `data/minecraft/tags/damage_type/bypasses_armor.json` and `is_fire.json`; `Items.ELYTRA` sets `setDamageOnHurt(false)`. ## 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:14:22 +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#4058
No description provided.