[PR #2192] [MERGED] Piglins walk away from soul fire, soul torches, soul lanterns and lit soul campfires #4091

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

📋 Pull Request Information

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

Base: main ← Head: fix/piglin-soul-fire-repellents


📝 Commits (3)

  • f24ca40 Piglins walk away from soul fire, soul torches, soul lanterns and lit soul campfires
  • 84b6210 Satisfy clippy
  • 37825b7 Piglin AI: name the piglin repellent finder for its mob

📊 Changes

3 files changed (+102 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/mobs.rs (+3 -0)
📝 crates/horizon-client/src/mobs/piglin.rs (+70 -1)
📝 crates/horizon-client/src/mobs/world.rs (+29 -0)

📄 Description

What and why

Piglins did not mind soul fire at all. In vanilla, blocks from #piglin_repellents (soul fire, soul torch, soul wall torch, soul lantern and a lit soul campfire) push piglins away, which is how players keep them out of a build.

Piglins now:

  • look for the nearest repelling block every 20 ticks, within 8 blocks sideways and 4 up or down (a soul campfire only counts while it is lit);
  • when one is closer than 8 blocks and the piglin is idle (no attack target, not admiring, not already walking somewhere), pick a spot about 16 blocks away from it and walk there at speed 1.0. A piglin that is already walking finishes its walk first, as in vanilla.

Piglin brutes are not affected, as in vanilla.

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: the retreat ambient sound that vanilla plays while a piglin is near a repellent (Horizon always plays the plain piglin ambient sound), and the celebrate activity, which Horizon does not have.

Vanilla reference

  • PiglinSpecificSensor.findNearestRepellent and isValidRepellent (CampfireBlock.isLitCampfire).
  • PiglinAi.avoidRepellent() = SetWalkTargetAwayFrom.pos(NEAREST_REPELLENT, 1.0, 8, false), used in the idle activity.

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/2192 **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/piglin-soul-fire-repellents` --- ### 📝 Commits (3) - [`f24ca40`](https://github.com/horizon-rust/horizon/commit/f24ca405a8a4c13a41a857264ad790ffe8afe9a7) Piglins walk away from soul fire, soul torches, soul lanterns and lit soul campfires - [`84b6210`](https://github.com/horizon-rust/horizon/commit/84b621096a193b3ff34fa2db9b93d4201c419c35) Satisfy clippy - [`37825b7`](https://github.com/horizon-rust/horizon/commit/37825b750a8908d8682dc2d63b751c3d712dd608) Piglin AI: name the piglin repellent finder for its mob ### 📊 Changes **3 files changed** (+102 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs.rs` (+3 -0) 📝 `crates/horizon-client/src/mobs/piglin.rs` (+70 -1) 📝 `crates/horizon-client/src/mobs/world.rs` (+29 -0) </details> ### 📄 Description ## What and why Piglins did not mind soul fire at all. In vanilla, blocks from `#piglin_repellents` (soul fire, soul torch, soul wall torch, soul lantern and a lit soul campfire) push piglins away, which is how players keep them out of a build. Piglins now: - look for the nearest repelling block every 20 ticks, within 8 blocks sideways and 4 up or down (a soul campfire only counts while it is lit); - when one is closer than 8 blocks and the piglin is idle (no attack target, not admiring, not already walking somewhere), pick a spot about 16 blocks away from it and walk there at speed 1.0. A piglin that is already walking finishes its walk first, as in vanilla. Piglin brutes are not affected, as in vanilla. `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: the retreat ambient sound that vanilla plays while a piglin is near a repellent (Horizon always plays the plain piglin ambient sound), and the celebrate activity, which Horizon does not have. ## Vanilla reference - `PiglinSpecificSensor.findNearestRepellent` and `isValidRepellent` (`CampfireBlock.isLitCampfire`). - `PiglinAi.avoidRepellent()` = `SetWalkTargetAwayFrom.pos(NEAREST_REPELLENT, 1.0, 8, false)`, used in the idle activity. ## 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:37 +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#4091
No description provided.