[PR #3560] [MERGED] Count a zombie villager's cure down in its tick, with or without AI #5051

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

📋 Pull Request Information

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

Base: main ← Head: fix-3429


📝 Commits (1)

  • 8dffd2b Count a zombie villager's cure down in its tick, with or without AI

📊 Changes

3 files changed (+92 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/mobs/ai.rs (+5 -0)
📝 crates/horizon-client/src/mobs/undead.rs (+0 -3)
📝 crates/horizon-client/src/mobs/zombie_villager.rs (+87 -0)

📄 Description

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

What and why

Fixes #3429

A zombie villager with NoAI:1b never finished curing: its ConversionTime stayed where it was, so it stayed a zombie villager. The same zombie villager without NoAI turned into a villager as expected.

The countdown (zombie_villager::step) ran from undead::custom_server_ai_step, which runs from ai_step, and ai::tick skips the whole of ai_step for a mob with no AI. In vanilla the countdown is in ZombieVillager.tick, before super.tick(), and NoAI only turns off serverAiStep.

The call moves from custom_server_ai_step to the start of ai::tick (after the despawn check and the pre-tick hooks, before the base tick), so it runs for every converting zombie villager whatever its NoAI flag. That is also where vanilla draws the getConversionProgress random number: before the rest of the tick, not after the goals.

Vanilla reference

net.minecraft.world.entity.monster.zombie.ZombieVillager.tick (javap of the 26.3 client jar): if (!level().isClientSide() && isAlive() && isConverting()) { villagerConversionTime -= getConversionProgress(); if (villagerConversionTime <= 0) finishConversion((ServerLevel) level()); } super.tick();. There is no isNoAi() check on that path; Mob.serverAiStep is what NoAI skips.

No parity harness covers curing (test_mob_ai_parity.py has no zombie villager scenario and no conversion support). The new unit test mobs::zombie_villager::tests::a_no_ai_zombie_villager_still_cures ticks a zombie villager with a 3-tick cure through Mob::tick, once with AI and once with NoAI, and expects the CureZombieVillager event within 3 ticks. It loads the prepared resources (.local/horizon-client/26.3) and returns early without them, like the other resource-backed tests.

Before (origin/main 8f0c17895, the fix reverted):

test mobs::zombie_villager::tests::a_cure_round_trips_through_nbt ... ok
test mobs::zombie_villager::tests::no_cure_saves_minus_one ... ok
test mobs::zombie_villager::tests::a_no_ai_zombie_villager_still_cures ... FAILED
no_ai=true: the cure must finish within its 3 ticks, took 10
test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured; 639 filtered out

After:

test mobs::zombie_villager::tests::a_cure_round_trips_through_nbt ... ok
test mobs::zombie_villager::tests::no_cure_saves_minus_one ... ok
test mobs::zombie_villager::tests::a_no_ai_zombie_villager_still_cures ... ok
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 639 filtered out

Self-check

Run on Windows 11. tools/pr_ready.py was not run; these are the commands I ran:

cargo fmt --all -- --check                                                    ok
cargo clippy -p horizon-client --features mods --all-targets -- -D warnings   ok
cargo test --profile fast -p horizon-client --lib mobs::zombie_villager      3 passed (the new test fails with the fix reverted)
cargo build --profile fast -p horizon-client --features mods --bins           ok

In game

In game (single player, default server thread, Easy, creative), the issue's steps on a stone platform: /summon minecraft:zombie_villager 2.5 121 5.5 {NoAI:1b,ConversionTime:200,PersistenceRequired:1b,Tags:["za"],CustomName:"NoAI",CustomNameVisible:1b} and the same without NoAI (named "AI"), then 12 seconds later /data get entity @e[tag=za,limit=1] ConversionTime and /execute as ... run say.

Before (origin/main b19b4e92d): "NoAI" is still a zombie villager with ConversionTime 200; "AI" became a villager.

After (this branch): both are villagers ("[NoAI] I am a villager", "[AI] I am a villager"); the data get finds no zombie villager left.

Seen while testing, not changed here: the cured "AI" villager keeps burning from the daylight it caught as a zombie villager, and a NoAI zombie villager does not catch fire in daylight (the separate NoAI-undead-burning issue mentioned in #3429).

🤖 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/3560 **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-3429` --- ### 📝 Commits (1) - [`8dffd2b`](https://github.com/horizon-rust/horizon/commit/8dffd2b847ecd270f5417a77febf2675efffea4f) Count a zombie villager's cure down in its tick, with or without AI ### 📊 Changes **3 files changed** (+92 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/ai.rs` (+5 -0) 📝 `crates/horizon-client/src/mobs/undead.rs` (+0 -3) 📝 `crates/horizon-client/src/mobs/zombie_villager.rs` (+87 -0) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves. ## What and why Fixes #3429 A zombie villager with `NoAI:1b` never finished curing: its `ConversionTime` stayed where it was, so it stayed a zombie villager. The same zombie villager without NoAI turned into a villager as expected. The countdown (`zombie_villager::step`) ran from `undead::custom_server_ai_step`, which runs from `ai_step`, and `ai::tick` skips the whole of `ai_step` for a mob with no AI. In vanilla the countdown is in `ZombieVillager.tick`, before `super.tick()`, and NoAI only turns off `serverAiStep`. The call moves from `custom_server_ai_step` to the start of `ai::tick` (after the despawn check and the pre-tick hooks, before the base tick), so it runs for every converting zombie villager whatever its NoAI flag. That is also where vanilla draws the `getConversionProgress` random number: before the rest of the tick, not after the goals. ## Vanilla reference `net.minecraft.world.entity.monster.zombie.ZombieVillager.tick` (javap of the 26.3 client jar): `if (!level().isClientSide() && isAlive() && isConverting()) { villagerConversionTime -= getConversionProgress(); if (villagerConversionTime <= 0) finishConversion((ServerLevel) level()); } super.tick();`. There is no `isNoAi()` check on that path; `Mob.serverAiStep` is what NoAI skips. No parity harness covers curing (`test_mob_ai_parity.py` has no zombie villager scenario and no conversion support). The new unit test `mobs::zombie_villager::tests::a_no_ai_zombie_villager_still_cures` ticks a zombie villager with a 3-tick cure through `Mob::tick`, once with AI and once with NoAI, and expects the `CureZombieVillager` event within 3 ticks. It loads the prepared resources (`.local/horizon-client/26.3`) and returns early without them, like the other resource-backed tests. Before (origin/main 8f0c17895, the fix reverted): ``` test mobs::zombie_villager::tests::a_cure_round_trips_through_nbt ... ok test mobs::zombie_villager::tests::no_cure_saves_minus_one ... ok test mobs::zombie_villager::tests::a_no_ai_zombie_villager_still_cures ... FAILED no_ai=true: the cure must finish within its 3 ticks, took 10 test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured; 639 filtered out ``` After: ``` test mobs::zombie_villager::tests::a_cure_round_trips_through_nbt ... ok test mobs::zombie_villager::tests::no_cure_saves_minus_one ... ok test mobs::zombie_villager::tests::a_no_ai_zombie_villager_still_cures ... ok test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 639 filtered out ``` ## Self-check Run on Windows 11. `tools/pr_ready.py` was not run; these are the commands I ran: ``` cargo fmt --all -- --check ok cargo clippy -p horizon-client --features mods --all-targets -- -D warnings ok cargo test --profile fast -p horizon-client --lib mobs::zombie_villager 3 passed (the new test fails with the fix reverted) cargo build --profile fast -p horizon-client --features mods --bins ok ``` ## In game In game (single player, default server thread, Easy, creative), the issue's steps on a stone platform: `/summon minecraft:zombie_villager 2.5 121 5.5 {NoAI:1b,ConversionTime:200,PersistenceRequired:1b,Tags:["za"],CustomName:"NoAI",CustomNameVisible:1b}` and the same without NoAI (named "AI"), then 12 seconds later `/data get entity @e[tag=za,limit=1] ConversionTime` and `/execute as ... run say`. Before (origin/main b19b4e92d): "NoAI" is still a zombie villager with `ConversionTime` 200; "AI" became a villager. After (this branch): both are villagers ("[NoAI] I am a villager", "[AI] I am a villager"); the `data get` finds no zombie villager left. Seen while testing, not changed here: the cured "AI" villager keeps burning from the daylight it caught as a zombie villager, and a NoAI zombie villager does not catch fire in daylight (the separate NoAI-undead-burning issue mentioned in #3429). 🤖 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:09:53 +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#5051
No description provided.