[PR #2191] [MERGED] Hoglins keep away from warped fungus, nether portals and respawn anchors #4089

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

📋 Pull Request Information

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

Base: main ← Head: fix/hoglin-repellents


📝 Commits (3)

  • fd1d857 Hoglins keep away from warped fungus, portals and respawn anchors
  • f0d2a2a Satisfy clippy
  • 68aa701 Piglin AI: name the hoglin repellent finder for its mob

📊 Changes

4 files changed (+129 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/mobs.rs (+3 -0)
📝 crates/horizon-client/src/mobs/ai.rs (+14 -0)
📝 crates/horizon-client/src/mobs/piglin.rs (+83 -3)
📝 crates/horizon-client/src/mobs/world.rs (+29 -0)

📄 Description

What and why

Hoglins ignored the #hoglin_repellents blocks (warped fungus, potted warped fungus, nether portal, respawn anchor), so a hoglin would happily charge a player standing next to a nether portal. In vanilla these blocks keep hoglins away.

Hoglins now:

  • look for the nearest repelling block every 20 ticks, within 8 blocks sideways and 4 up or down;
  • become passive for 200 ticks while one is found: the attack target is dropped and no new player target is picked (a hit ends the passive state, and it comes back on the next tick if the block is still near);
  • walk away from a repelling block that is closer than 8 blocks (random spot 16 blocks away, speed 1.0);
  • score random walk spots within 8 blocks of the block as bad (-1) and crimson nylium as good (10), as Hoglin.getWalkTargetValue does. Hoglins used the generic monster value before.

MobWorld::nearest_block is a small helper that walks the box in the same order as BlockPos.withinBoxByManhattanDistance, so ties pick the same block as vanilla.

Left out: vanilla also stops a passive hoglin from falling in love when fed (Hoglin.canFallInLove). Horizon has no shared breeding check to hook that into.

Vanilla reference

  • HoglinSpecificSensor.findNearestRepellent (findBlocksInBoxByManhattanDistance(pos, 8, 4)).
  • HoglinAi: BecomePassiveIfMemoryPresent(NEAREST_REPELLENT, 200), SetWalkTargetAwayFrom.pos(NEAREST_REPELLENT, 1.0, 8, true), findNearestValidAttackTarget (nothing while pacified), wasHurtBy (erases PACIFIED).
  • Hoglin.getWalkTargetValue, HoglinAi.isPosNearNearestRepellent.

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/2191 **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/hoglin-repellents` --- ### 📝 Commits (3) - [`fd1d857`](https://github.com/horizon-rust/horizon/commit/fd1d857f1ba2485b468b8bfcdf45e79ce7517d50) Hoglins keep away from warped fungus, portals and respawn anchors - [`f0d2a2a`](https://github.com/horizon-rust/horizon/commit/f0d2a2ae741f0319ff66e7e04cfb5dfdb13c2f54) Satisfy clippy - [`68aa701`](https://github.com/horizon-rust/horizon/commit/68aa70108f3c757bcef066c473645533d7e1d656) Piglin AI: name the hoglin repellent finder for its mob ### 📊 Changes **4 files changed** (+129 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs.rs` (+3 -0) 📝 `crates/horizon-client/src/mobs/ai.rs` (+14 -0) 📝 `crates/horizon-client/src/mobs/piglin.rs` (+83 -3) 📝 `crates/horizon-client/src/mobs/world.rs` (+29 -0) </details> ### 📄 Description ## What and why Hoglins ignored the `#hoglin_repellents` blocks (warped fungus, potted warped fungus, nether portal, respawn anchor), so a hoglin would happily charge a player standing next to a nether portal. In vanilla these blocks keep hoglins away. Hoglins now: - look for the nearest repelling block every 20 ticks, within 8 blocks sideways and 4 up or down; - become passive for 200 ticks while one is found: the attack target is dropped and no new player target is picked (a hit ends the passive state, and it comes back on the next tick if the block is still near); - walk away from a repelling block that is closer than 8 blocks (random spot 16 blocks away, speed 1.0); - score random walk spots within 8 blocks of the block as bad (-1) and crimson nylium as good (10), as `Hoglin.getWalkTargetValue` does. Hoglins used the generic monster value before. `MobWorld::nearest_block` is a small helper that walks the box in the same order as `BlockPos.withinBoxByManhattanDistance`, so ties pick the same block as vanilla. Left out: vanilla also stops a passive hoglin from falling in love when fed (`Hoglin.canFallInLove`). Horizon has no shared breeding check to hook that into. ## Vanilla reference - `HoglinSpecificSensor.findNearestRepellent` (`findBlocksInBoxByManhattanDistance(pos, 8, 4)`). - `HoglinAi`: `BecomePassiveIfMemoryPresent(NEAREST_REPELLENT, 200)`, `SetWalkTargetAwayFrom.pos(NEAREST_REPELLENT, 1.0, 8, true)`, `findNearestValidAttackTarget` (nothing while pacified), `wasHurtBy` (erases `PACIFIED`). - `Hoglin.getWalkTargetValue`, `HoglinAi.isPosNearNearestRepellent`. ## 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:35 +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#4089
No description provided.