[PR #7579] Respect Fire Resistance in mob damage handling #7689

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7579
Author: @TheMrZZ
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/mob-fire-resistance


📝 Commits (2)

  • 5b5f2e0 Respect Fire Resistance in mob damage handling
  • edab224 Merge main into mob Fire Resistance fix

📊 Changes

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

View changed files

📝 crates/horizon-client/src/mobs.rs (+101 -0)
📝 tools/command_exec_corpus.py (+27 -0)

📄 Description

🤖 Opened by TheMrZZ's AI agent (Codex, gpt-6.1-sol), not by TheMrZZ personally.

What and why

Fixes #7572. A pig with Fire Resistance now refuses fire damage from /damage, keeping its health and hurt cooldown unchanged. Add the missing LivingEntity effect guard in Mob::damage_with after the existing species hurt callbacks and before damage hooks and health processing, using the existing fire classification. Preserve the existing reflected-ghast path's success return even when Fire Resistance refuses the health damage.

The real mob damage tests fail on old source and pass with this guard. They cover all represented fire kinds, ordinary damage and cooldowns, Resistance, invulnerability, a subsequent non-fire hit, the reflected-ghast return distinction, and bat wake-up ordering. The native command corpus adds 256 observations for all eight fire command types and controls, with a fresh UUID for every case.

Closed #7251 was an invalid player lava test caused by suffocation; this issue reproduces on mobs through command damage. No player, natural-contact caller, armor or equipment-wear changes.

Kind

  • parity: Horizon now does what vanilla 26.3 does

Vanilla reference

Java 26.3 LivingEntity.hurtServer rejects an IS_FIRE source when FIRE_RESISTANCE is present before further damage processing. Ghast.hurtServer calls its superclass with 1000 damage for a reflected fireball, discards the superclass boolean and returns true. This PR preserves that return distinction without changing reflection detection.

Native cases cover campfire, fireball, hot_floor, in_fire, lava, on_fire, sulfur_cube_hot and unattributed_fireball, with normal, Fire Resistance, Resistance and invulnerable pigs; cactus and generic non-fire controls; repeated equal and stronger hits. Focused native Game command execution now matches fresh official Java 26.3 on 256/256 observations. Natural-contact behavior remains unverified.

Other projects' code

None.

Self-check

pr_ready (tools/pr_ready.py --quick on a local runner, against origin/main at c7b92e617, 7 min 44 s)

Check Result
Scope ✅ 2 files, +128 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 614 passed (53 s)
rustfmt ✅ (6 s)
clippy ✅ (1 min 54 s)
tests: horizon-client-lib ✅ 1493 passed (4 min 49 s)
doc tests ✅ 0 passed (2 s)
content root tests ➖ content root untouched
mod API up to date ➖ native hooks untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Focused mob regressions: two core tests fail on old source; all three final tests pass, including species callback ordering.

🤖 Generated with Codex.


🔄 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/7579 **Author:** [@TheMrZZ](https://github.com/TheMrZZ) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/mob-fire-resistance` --- ### 📝 Commits (2) - [`5b5f2e0`](https://github.com/horizon-rust/horizon/commit/5b5f2e0422875e07774685aa679a07fee9023213) Respect Fire Resistance in mob damage handling - [`edab224`](https://github.com/horizon-rust/horizon/commit/edab224760295a6961ecd841bd0e6ff6af5f186f) Merge main into mob Fire Resistance fix ### 📊 Changes **2 files changed** (+128 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs.rs` (+101 -0) 📝 `tools/command_exec_corpus.py` (+27 -0) </details> ### 📄 Description > 🤖 Opened by TheMrZZ's AI agent (Codex, gpt-6.1-sol), not by TheMrZZ personally. ## What and why Fixes #7572. A pig with Fire Resistance now refuses fire damage from `/damage`, keeping its health and hurt cooldown unchanged. Add the missing LivingEntity effect guard in `Mob::damage_with` after the existing species hurt callbacks and before damage hooks and health processing, using the existing fire classification. Preserve the existing reflected-ghast path's success return even when Fire Resistance refuses the health damage. The real mob damage tests fail on old source and pass with this guard. They cover all represented fire kinds, ordinary damage and cooldowns, Resistance, invulnerability, a subsequent non-fire hit, the reflected-ghast return distinction, and bat wake-up ordering. The native command corpus adds 256 observations for all eight fire command types and controls, with a fresh UUID for every case. Closed #7251 was an invalid player lava test caused by suffocation; this issue reproduces on mobs through command damage. No player, natural-contact caller, armor or equipment-wear changes. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Vanilla reference Java 26.3 `LivingEntity.hurtServer` rejects an IS_FIRE source when FIRE_RESISTANCE is present before further damage processing. `Ghast.hurtServer` calls its superclass with 1000 damage for a reflected fireball, discards the superclass boolean and returns true. This PR preserves that return distinction without changing reflection detection. Native cases cover campfire, fireball, hot_floor, in_fire, lava, on_fire, sulfur_cube_hot and unattributed_fireball, with normal, Fire Resistance, Resistance and invulnerable pigs; cactus and generic non-fire controls; repeated equal and stronger hits. Focused native Game command execution now matches fresh official Java 26.3 on **256/256 observations**. Natural-contact behavior remains unverified. ## Other projects' code None. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on a local runner, against origin/main at c7b92e617, 7 min 44 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +128 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 614 passed (53 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (1 min 54 s) | | tests: horizon-client-lib | ✅ 1493 passed (4 min 49 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | mod API up to date | ➖ native hooks untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Focused mob regressions: two core tests fail on old source; all three final tests pass, including species callback ordering. 🤖 Generated with [Codex](https://openai.com/codex/). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7689
No description provided.