[PR #2162] [MERGED] Zombies call reinforcements when hurt on Hard #4060

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

📋 Pull Request Information

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

Base: main ← Head: fix/zombie-reinforcements


📝 Commits (1)

  • d622030 Zombies call reinforcements when hurt on Hard

📊 Changes

8 files changed (+238 additions, -56 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+4 -0)
📝 crates/horizon-client/src/game/creatures.rs (+4 -0)
➕ crates/horizon-client/src/game/zombie_reinforcements.rs (+134 -0)
📝 crates/horizon-client/src/mobs.rs (+6 -0)
📝 crates/horizon-client/src/mobs/ai.rs (+5 -0)
📝 crates/horizon-client/src/mobs/finalize.rs (+62 -55)
📝 crates/horizon-client/src/mobs/spawning.rs (+12 -0)
📝 crates/horizon-client/src/mobs/undead.rs (+11 -1)

📄 Description

What and why

Zombies never called reinforcements. On Hard, a hurt zombie that has a target (its own, or the living thing that just hit it) should sometimes bring another zombie of its kind, and in Horizon that never happened.

Two things were missing:

  • The call itself. Zombie.hurtServer's reinforcement step now runs after a hit lands. On Hard, with the zombie's spawn_reinforcements chance, while monsters may spawn, it tries up to 50 spots 7 to 40 blocks away (each axis offset by 7 to 40 blocks, in either direction or not at all). A spot needs a valid spawn surface and the zombie spawn rules, no alive player within 7 blocks, and room for the zombie standing on the block's corner (no collision, no mob in the way, no liquid unless it is a drowned). The new zombie takes the same target and is finalized like any spawn. Then the caller's reinforcement_caller_charge drops by 0.05 and the new zombie gets reinforcement_callee_charge (-0.05), so chains die out.
  • The chance itself. New zombies, husks, drowned, zombie villagers and zombified piglins did not run Zombie.handleAttributes, so their chance stayed at 0 and no leader bonus was ever rolled. They now do (zombie_attributes, moved out of the exact finalizer so the game can call it). This also gives them the random knockback resistance and follow range bonus and the leader's extra health from the same vanilla method.

The hit hands the request to the game as a MobEvent::Reinforcements, because the spot search needs the world and the level random. The two places that took a mob's outbox only to play its hurt sound now keep the other events for the end of the tick.

Not done: zombies loaded from a save lose the chance they rolled, since saves do not store it yet.

Vanilla reference

  • Zombie.hurtServer (reinforcement step), Zombie.handleAttributes and randomizeReinforcementsChance
  • ServerLevel.isSpawningMonsters, SpawnPlacements.isSpawnPositionOk and checkSpawnRules with EntitySpawnReason.REINFORCEMENT
  • Level.hasNearbyAlivePlayer, isUnobstructed, noCollision, containsAnyLiquid, Drowned.canSpawnInLiquids

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/2162 **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/zombie-reinforcements` --- ### 📝 Commits (1) - [`d622030`](https://github.com/horizon-rust/horizon/commit/d622030988cc744f6e9ec42ba3e4a42ff89ea70b) Zombies call reinforcements when hurt on Hard ### 📊 Changes **8 files changed** (+238 additions, -56 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+4 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+4 -0) ➕ `crates/horizon-client/src/game/zombie_reinforcements.rs` (+134 -0) 📝 `crates/horizon-client/src/mobs.rs` (+6 -0) 📝 `crates/horizon-client/src/mobs/ai.rs` (+5 -0) 📝 `crates/horizon-client/src/mobs/finalize.rs` (+62 -55) 📝 `crates/horizon-client/src/mobs/spawning.rs` (+12 -0) 📝 `crates/horizon-client/src/mobs/undead.rs` (+11 -1) </details> ### 📄 Description ## What and why Zombies never called reinforcements. On Hard, a hurt zombie that has a target (its own, or the living thing that just hit it) should sometimes bring another zombie of its kind, and in Horizon that never happened. Two things were missing: - **The call itself.** `Zombie.hurtServer`'s reinforcement step now runs after a hit lands. On Hard, with the zombie's `spawn_reinforcements` chance, while monsters may spawn, it tries up to 50 spots 7 to 40 blocks away (each axis offset by 7 to 40 blocks, in either direction or not at all). A spot needs a valid spawn surface and the zombie spawn rules, no alive player within 7 blocks, and room for the zombie standing on the block's corner (no collision, no mob in the way, no liquid unless it is a drowned). The new zombie takes the same target and is finalized like any spawn. Then the caller's `reinforcement_caller_charge` drops by 0.05 and the new zombie gets `reinforcement_callee_charge` (-0.05), so chains die out. - **The chance itself.** New zombies, husks, drowned, zombie villagers and zombified piglins did not run `Zombie.handleAttributes`, so their chance stayed at 0 and no leader bonus was ever rolled. They now do (`zombie_attributes`, moved out of the exact finalizer so the game can call it). This also gives them the random knockback resistance and follow range bonus and the leader's extra health from the same vanilla method. The hit hands the request to the game as a `MobEvent::Reinforcements`, because the spot search needs the world and the level random. The two places that took a mob's outbox only to play its hurt sound now keep the other events for the end of the tick. Not done: zombies loaded from a save lose the chance they rolled, since saves do not store it yet. ## Vanilla reference - `Zombie.hurtServer` (reinforcement step), `Zombie.handleAttributes` and `randomizeReinforcementsChance` - `ServerLevel.isSpawningMonsters`, `SpawnPlacements.isSpawnPositionOk` and `checkSpawnRules` with `EntitySpawnReason.REINFORCEMENT` - `Level.hasNearbyAlivePlayer`, `isUnobstructed`, `noCollision`, `containsAnyLiquid`, `Drowned.canSpawnInLiquids` ## 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:24 +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#4060
No description provided.