[PR #6100] [MERGED] Lava and fire hit mobs on time, and wither roses wither them #6654

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

📋 Pull Request Information

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

Base: main ← Head: fix/lava-and-rose


📝 Commits (1)

  • ea7c0c4 Lava and fire hit mobs on time, and wither roses wither them

📊 Changes

1 file changed (+118 additions, -20 deletions)

View changed files

📝 crates/horizon-client/src/mobs/ai.rs (+118 -20)

📄 Description

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

What and why

Two mob bugs found by running the same scenes on the real 26.3 server and on Horizon side by side.

  1. Wither rose never gave Wither to a mob. flower_contact_effects returned early on the regional difficulty (0.0 in a fresh chunk) and skipped the mob while its hit timer was running. Vanilla checks the world difficulty (not peaceful) and isInvulnerableTo(wither), which does not use the hit timer. Now it does the same.
  2. Lava and fire damage landed one hit period late, and the burn timer read 1 low. Vanilla applies fire and lava (applyEffectsFromBlocks, in LivingEntity.aiStep) and ticks mob effects (tickEffects) after baseTick has counted the fire timer and the hit timers down. Horizon applied them before. So a golem in lava showed Fire 299 instead of 300 (160 vs 159 in a fire block), and the second hit came on tick 11 instead of tick 10 in vanilla's phase. Fire/lava contact and effect ticking now run after the timers count down.

Changed: crates/horizon-client/src/mobs/ai.rs only.

Fixes #6099

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

WitherRoseBlock.entityInside (difficulty != PEACEFUL, isInvulnerableTo), LivingEntity.isInvulnerableTo / isInvulnerableToBase, LivingEntity.hurtServer (cooldown > 10 rule), LivingEntity.baseTick (timers, then tickEffects), LivingEntity.aiStep (calls applyEffectsFromBlocks after travel), Entity.baseTick (fire countdown), Entity.lavaHurt, InsideBlockEffectType (FIRE_IGNITE, LAVA_IGNITE).

Test

Two unit tests in mobs/ai.rs (burn_and_rose_tests):

  • a golem with a running hit timer on a wither rose gets Wither at normal difficulty and none at peaceful;
  • a golem in lava reads Fire 300 and a full 20-tick hit timer after its first tick, loses 4 HP, and takes the second hit on tick 11.

Both fail with the fix reverted (Fire read 299, no Wither) and pass with it.

Numbers

Side-by-side hazards scene (iron golem, 100 HP, 60 ticks), vanilla / before / after:

tick 10 tick 20 tick 60 Fire
lava HP 92 / 96 / 92 88 / 92 / 88 72 / 76 / 72 300 / 299 / 300
fire block HP 98 / 99 / 98 97 / 98 / 97 93 / 94 / 93 160 / 159 / 160
wither rose HP 98 / 99 / 98 97 / 98 / 97 93 / 94 / 93 no Wither effect before, present after

Whole scene after the fix: 0 differences in 581 probed values apart from amplifier: 0b in the effect NBT text, which Horizon writes and vanilla omits (separate, cosmetic). A per-tick lava scene shows HurtTime 10 on tick 1 as in vanilla (9 before).

What wasn't compared

  • Only server-side state of golems with no AI; no player, no client rendering, no sounds or particles.
  • Other mobs, armour, Fire Resistance, rain and water extinguishing were not run against vanilla (the rain-clears-fire order is kept by a rain check after the contact effects).
  • The effects scene was re-run: no new differences (the known instant damage/heal, absorption and slow falling ones remain).
  • Eyeblossom (bee poison) shares the function but was not changed or compared.
  • Players are not covered; this only touches mobs.

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 308ef6527, 4 min 43 s)

Check Result
Scope ✅ 2 files, +118 −20
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ✅ 533 passed (19 s)
rustfmt ✅ (5 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 ✅ 1753 passed (2 min 58 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 ➖ 325 affected, to run in CI (--quick): armor_stand_frost, arrow, auto_jump, block_removal, boat_paddle_reset, boat_submerged, bulk_section, bundle_weight, camera, canyon_carver, carving_geometry, carving_mask and 313 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/6100 **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/lava-and-rose` --- ### 📝 Commits (1) - [`ea7c0c4`](https://github.com/horizon-rust/horizon/commit/ea7c0c48562a4a9742f4d8bf94bdd77753cb5552) Lava and fire hit mobs on time, and wither roses wither them ### 📊 Changes **1 file changed** (+118 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/ai.rs` (+118 -20) </details> ### 📄 Description > 🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself. ## What and why Two mob bugs found by running the same scenes on the real 26.3 server and on Horizon side by side. 1. **Wither rose never gave Wither to a mob.** `flower_contact_effects` returned early on the regional difficulty (0.0 in a fresh chunk) and skipped the mob while its hit timer was running. Vanilla checks the world difficulty (not peaceful) and `isInvulnerableTo(wither)`, which does not use the hit timer. Now it does the same. 2. **Lava and fire damage landed one hit period late, and the burn timer read 1 low.** Vanilla applies fire and lava (`applyEffectsFromBlocks`, in `LivingEntity.aiStep`) and ticks mob effects (`tickEffects`) after `baseTick` has counted the fire timer and the hit timers down. Horizon applied them before. So a golem in lava showed Fire 299 instead of 300 (160 vs 159 in a fire block), and the second hit came on tick 11 instead of tick 10 in vanilla's phase. Fire/lava contact and effect ticking now run after the timers count down. Changed: `crates/horizon-client/src/mobs/ai.rs` only. Fixes #6099 ## 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 `WitherRoseBlock.entityInside` (difficulty != PEACEFUL, `isInvulnerableTo`), `LivingEntity.isInvulnerableTo` / `isInvulnerableToBase`, `LivingEntity.hurtServer` (cooldown > 10 rule), `LivingEntity.baseTick` (timers, then `tickEffects`), `LivingEntity.aiStep` (calls `applyEffectsFromBlocks` after `travel`), `Entity.baseTick` (fire countdown), `Entity.lavaHurt`, `InsideBlockEffectType` (FIRE_IGNITE, LAVA_IGNITE). ## Test Two unit tests in `mobs/ai.rs` (`burn_and_rose_tests`): - a golem with a running hit timer on a wither rose gets Wither at normal difficulty and none at peaceful; - a golem in lava reads Fire 300 and a full 20-tick hit timer after its first tick, loses 4 HP, and takes the second hit on tick 11. Both fail with the fix reverted (Fire read 299, no Wither) and pass with it. ## Numbers Side-by-side `hazards` scene (iron golem, 100 HP, 60 ticks), vanilla / before / after: | | tick 10 | tick 20 | tick 60 | Fire | |---|---|---|---|---| | lava HP | 92 / 96 / 92 | 88 / 92 / 88 | 72 / 76 / 72 | 300 / 299 / 300 | | fire block HP | 98 / 99 / 98 | 97 / 98 / 97 | 93 / 94 / 93 | 160 / 159 / 160 | | wither rose HP | 98 / 99 / 98 | 97 / 98 / 97 | 93 / 94 / 93 | no Wither effect before, present after | Whole scene after the fix: 0 differences in 581 probed values apart from `amplifier: 0b` in the effect NBT text, which Horizon writes and vanilla omits (separate, cosmetic). A per-tick lava scene shows `HurtTime` 10 on tick 1 as in vanilla (9 before). ## What wasn't compared - Only server-side state of golems with no AI; no player, no client rendering, no sounds or particles. - Other mobs, armour, Fire Resistance, rain and water extinguishing were not run against vanilla (the rain-clears-fire order is kept by a rain check after the contact effects). - The `effects` scene was re-run: no new differences (the known instant damage/heal, absorption and slow falling ones remain). - Eyeblossom (bee poison) shares the function but was not changed or compared. - Players are not covered; this only touches mobs. 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 308ef6527, 4 min 43 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +118 −20 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ✅ 533 passed (19 s) | | rustfmt | ✅ (5 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 | ✅ 1753 passed (2 min 58 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 | ➖ 325 affected, to run in CI (--quick): armor_stand_frost, arrow, auto_jump, block_removal, boat_paddle_reset, boat_submerged, bulk_section, bundle_weight, camera, canyon_carver, carving_geometry, carving_mask and 313 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:24:25 +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#6654
No description provided.