[PR #3583] [MERGED] Mobs: undead with NoAI burn in daylight #5073

Closed
opened 2026-11-03 05:10:02 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3583
Author: @d3grando
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix-3430


📝 Commits (1)

  • cf0b5a8 Mobs: undead with NoAI burn in daylight

📊 Changes

2 files changed (+13 additions, -5 deletions)

View changed files

📝 crates/horizon-client/src/mobs/ai.rs (+11 -5)
📝 tools/test_mob_ai_parity.py (+2 -0)

📄 Description

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

What and why

Fixes #3430

A zombie (or any other mob that burns in daylight) summoned with NoAI:1b never caught fire in the sun. In vanilla it burns like any other zombie.

The cause is the one the issue describes. mobs/ai.rs tick skipped all of ai_step for a NoAI mob and ran only the endermite's lifetime. The daylight burn was inside ai_step, so it was skipped too. In vanilla, NoAI only skips Mob.serverAiStep. LivingEntity.tick still calls aiStep, and Mob.aiStep calls burnUndead with no NoAI or isEffectiveAi check.

The fix moves the burn into its own burn_undead. It runs from ai_step exactly as before, and the NoAI branch of tick now calls it too. For a mob with AI nothing changes: same check, same place, same random draw.

Not in this PR (the issue lists them as separate problems): helmet wear in the sun (burnUndead damages the head item by random.nextInt(2)), powder snow counting as wet in isSunBurnTick, and the burning-mob list (#2345).

Vanilla reference

From javap -c on the 26.3 jars (net.minecraft.world.entity.Mob):

  • Mob.aiStep: super.aiStep(), then burnUndead() for EntityTypeTags.BURN_IN_DAYLIGHT
  • Mob.burnUndead: isAlive() && isSunBurnTick(), then the sunProtectionSlot item, else igniteForSeconds(8)
  • Mob.isSunBurnTick
  • LivingEntity.aiStep (serverAiStep only when isEffectiveAi)

Harness: tools/test_mob_ai_parity.py gets a new scenario, zombie_noai_day_burn: a persistent NoAI zombie on the flat world at the default daytime. It is compared tick by tick with vanilla, including the mob's random state and its health. Fire damage brings the zombie from 20 to 15 health in 120 ticks.

Before the fix (origin/main, the burn's nextFloat missing on tick 1):

$ python tools/test_mob_ai_parity.py --only zombie_noai_day_burn skeleton_day_burn
skeleton_day_burn: all 121 ticks match
zombie_noai_day_burn mob 0: first divergence at tick 1 of 121 (random draws this tick: vanilla 2, horizon 1)
      vanilla 0 24=b5a210: Mob.isSunBurnTick:564 Mob.burnUndead:542 Mob.aiStep:516 Monster.aiStep:44 LivingEntity.tick:2886 Mob.tick:379 Zombie.tick:234
    rng: vanilla b5a210d753e6 | horizon ba5ef7d65667
1/2 scenarios match entirely; 122/242 mob-ticks match before each mob's first divergence

After:

$ python tools/test_mob_ai_parity.py --only zombie_noai_day_burn skeleton_day_burn
skeleton_day_burn: all 121 ticks match
zombie_noai_day_burn: all 121 ticks match
2/2 scenarios match entirely; 242/242 mob-ticks match before each mob's first divergence

The whole mob_ai harness after the fix: 170/172 scenarios match. The other two are creeper_alone (a look target differs in the last bit of a double, tick 92) and breeze_player (a velocity differs in the last bit, tick 70). Neither has a NoAI mob or an undead mob, and for a mob with AI this change runs the same code as before, so the change can't cause them. They look like Windows floating-point differences.

Self-check

Run on Windows 11. tools/pr_ready.py was not run; these are the steps it runs:

cargo fmt --all -- --check                                                    ok
cargo clippy -p horizon-client --features mods --all-targets -- -D warnings   ok
cargo test -p horizon-client --features mods --lib mobs::ai                   3 passed
python tools/test_mob_ai_parity.py --only zombie_noai_day_burn skeleton_day_burn   2/2 (1/2 before the fix)
python tools/test_mob_ai_parity.py                                            170/172 (creeper_alone, breeze_player: see above)

Screenshots

In game (server thread, the default): /time set noon, /weather clear, then a zombie with NoAI:1b (named "NoAI") and one without (named "AI") summoned side by side under open sky. After 100 ticks, /data get entity ... Fire:

  • Before: NoAI 0s, AI 133s. The NoAI zombie stands in the sun unburnt.
  • After: NoAI 128s, AI 126s. Both burn. The NoAI zombie is down to 5 health 200 ticks later.

🤖 Generated with Claude Code


🔄 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/3583 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix-3430` --- ### 📝 Commits (1) - [`cf0b5a8`](https://github.com/horizon-rust/horizon/commit/cf0b5a8e63df9ba5247aaf9a1b6b1a56f05b9f6e) Mobs: undead with NoAI burn in daylight ### 📊 Changes **2 files changed** (+13 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/ai.rs` (+11 -5) 📝 `tools/test_mob_ai_parity.py` (+2 -0) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves. ## What and why Fixes #3430 A zombie (or any other mob that burns in daylight) summoned with `NoAI:1b` never caught fire in the sun. In vanilla it burns like any other zombie. The cause is the one the issue describes. `mobs/ai.rs` `tick` skipped all of `ai_step` for a NoAI mob and ran only the endermite's lifetime. The daylight burn was inside `ai_step`, so it was skipped too. In vanilla, NoAI only skips `Mob.serverAiStep`. `LivingEntity.tick` still calls `aiStep`, and `Mob.aiStep` calls `burnUndead` with no NoAI or `isEffectiveAi` check. The fix moves the burn into its own `burn_undead`. It runs from `ai_step` exactly as before, and the NoAI branch of `tick` now calls it too. For a mob with AI nothing changes: same check, same place, same random draw. Not in this PR (the issue lists them as separate problems): helmet wear in the sun (`burnUndead` damages the head item by `random.nextInt(2)`), powder snow counting as wet in `isSunBurnTick`, and the burning-mob list (#2345). ## Vanilla reference From `javap -c` on the 26.3 jars (`net.minecraft.world.entity.Mob`): - `Mob.aiStep`: `super.aiStep()`, then `burnUndead()` for `EntityTypeTags.BURN_IN_DAYLIGHT` - `Mob.burnUndead`: `isAlive() && isSunBurnTick()`, then the `sunProtectionSlot` item, else `igniteForSeconds(8)` - `Mob.isSunBurnTick` - `LivingEntity.aiStep` (`serverAiStep` only when `isEffectiveAi`) Harness: `tools/test_mob_ai_parity.py` gets a new scenario, `zombie_noai_day_burn`: a persistent NoAI zombie on the flat world at the default daytime. It is compared tick by tick with vanilla, including the mob's random state and its health. Fire damage brings the zombie from 20 to 15 health in 120 ticks. Before the fix (origin/main, the burn's `nextFloat` missing on tick 1): ``` $ python tools/test_mob_ai_parity.py --only zombie_noai_day_burn skeleton_day_burn skeleton_day_burn: all 121 ticks match zombie_noai_day_burn mob 0: first divergence at tick 1 of 121 (random draws this tick: vanilla 2, horizon 1) vanilla 0 24=b5a210: Mob.isSunBurnTick:564 Mob.burnUndead:542 Mob.aiStep:516 Monster.aiStep:44 LivingEntity.tick:2886 Mob.tick:379 Zombie.tick:234 rng: vanilla b5a210d753e6 | horizon ba5ef7d65667 1/2 scenarios match entirely; 122/242 mob-ticks match before each mob's first divergence ``` After: ``` $ python tools/test_mob_ai_parity.py --only zombie_noai_day_burn skeleton_day_burn skeleton_day_burn: all 121 ticks match zombie_noai_day_burn: all 121 ticks match 2/2 scenarios match entirely; 242/242 mob-ticks match before each mob's first divergence ``` The whole mob_ai harness after the fix: 170/172 scenarios match. The other two are `creeper_alone` (a look target differs in the last bit of a double, tick 92) and `breeze_player` (a velocity differs in the last bit, tick 70). Neither has a NoAI mob or an undead mob, and for a mob with AI this change runs the same code as before, so the change can't cause them. They look like Windows floating-point differences. ## Self-check Run on Windows 11. `tools/pr_ready.py` was not run; these are the steps it runs: ``` cargo fmt --all -- --check ok cargo clippy -p horizon-client --features mods --all-targets -- -D warnings ok cargo test -p horizon-client --features mods --lib mobs::ai 3 passed python tools/test_mob_ai_parity.py --only zombie_noai_day_burn skeleton_day_burn 2/2 (1/2 before the fix) python tools/test_mob_ai_parity.py 170/172 (creeper_alone, breeze_player: see above) ``` ## Screenshots In game (server thread, the default): `/time set noon`, `/weather clear`, then a zombie with `NoAI:1b` (named "NoAI") and one without (named "AI") summoned side by side under open sky. After 100 ticks, `/data get entity ... Fire`: - **Before:** NoAI `0s`, AI `133s`. The NoAI zombie stands in the sun unburnt. - **After:** NoAI `128s`, AI `126s`. Both burn. The NoAI zombie is down to 5 health 200 ticks later. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:10:02 +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#5073
No description provided.