Piglin AI: name the hoglin repellent finder for its mob

#2191 and #2192 each add a `find_repellent` to piglin.rs, one for
hoglins and one for piglins; merged together they would collide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-26 16:23:05 +01:00
parent f0d2a2ae74
commit 68aa70108f
+2 -2
View File
@@ -214,7 +214,7 @@ impl Goal for GoToWantedItem {
}
/// `HoglinSpecificSensor.findNearestRepellent`: the nearest `#hoglin_repellents`
/// block within 8 blocks sideways and 4 up or down.
fn find_repellent(m: &Mob, w: &MobWorld) -> Option<[i32; 3]> {
fn find_hoglin_repellent(m: &Mob, w: &MobWorld) -> Option<[i32; 3]> {
let tag = w.block_tags.get("minecraft:hoglin_repellents")?;
let at = [
m.position.x.floor() as i32,
@@ -235,7 +235,7 @@ fn hoglin_repellent(m: &mut Mob, w: &MobWorld) {
m.extra.ints[0] = 0;
}
if m.age.wrapping_add(m.id).is_multiple_of(20) {
m.extra.repellent = find_repellent(m, w);
m.extra.repellent = find_hoglin_repellent(m, w);
}
if m.extra.ints[0] <= 0 && m.extra.repellent.is_some() {
m.extra.ints[0] = 200;