From c30d51d65e1cde584b319f7105c4e772737077ce Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Mon, 26 Oct 2026 19:41:45 +0100 Subject: [PATCH 1/2] Wolves fight other owners' tamed wolves --- crates/horizon-client/src/mobs.rs | 3 +++ crates/horizon-client/src/mobs/tame.rs | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/horizon-client/src/mobs.rs b/crates/horizon-client/src/mobs.rs index 6b1e16f5c..66257ea8e 100644 --- a/crates/horizon-client/src/mobs.rs +++ b/crates/horizon-client/src/mobs.rs @@ -1215,6 +1215,8 @@ pub struct Seen { pub baby: bool, pub in_love: bool, pub tame: bool, + /// A tamed animal's owner (`getOwner`). + pub owner: Option<[i32; 4]>, pub hostile: bool, pub target: Option, pub health: f32, @@ -1302,6 +1304,7 @@ impl Mob { m.extra.in_love > 0 }, tame: m.extra.tame, + owner: m.extra.owner, hostile: m.hostile(), target: m.ai.target, health: m.health, diff --git a/crates/horizon-client/src/mobs/tame.rs b/crates/horizon-client/src/mobs/tame.rs index 1e725df80..b6d0b1bb7 100644 --- a/crates/horizon-client/src/mobs/tame.rs +++ b/crates/horizon-client/src/mobs/tame.rs @@ -442,7 +442,8 @@ impl Goal for OwnerHurt { m.ai.target = None; } } -/// `Wolf.wantsToAttack`: never creepers, ghasts or tame wolves and cats. +/// `Wolf.wantsToAttack`: never creepers, ghasts, tame cats and parrots, or a +/// tame wolf of the same owner. fn wants_to_attack(m: &Mob, w: &MobWorld, who: Who) -> bool { let Who::Mob(id) = who else { return false; @@ -455,7 +456,8 @@ fn wants_to_attack(m: &Mob, w: &MobWorld, who: Who) -> bool { }; match s.species { Species::Creeper | Species::Ghast => false, - Species::Wolf | Species::Cat | Species::Parrot => !s.tame, + Species::Wolf => !s.tame || s.owner != m.extra.owner, + Species::Cat | Species::Parrot => !s.tame, Species::Horse | Species::Donkey | Species::Mule | Species::Llama => !s.tame, _ => true, } From 1a5e5eb35828554deff92538bc21dd50cb0f0209 Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Mon, 26 Oct 2026 21:37:58 +0100 Subject: [PATCH 2/2] Owner combat goals only follow the wolf's own owner --- crates/horizon-client/src/mobs/tame.rs | 28 ++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/crates/horizon-client/src/mobs/tame.rs b/crates/horizon-client/src/mobs/tame.rs index b6d0b1bb7..5c59f840d 100644 --- a/crates/horizon-client/src/mobs/tame.rs +++ b/crates/horizon-client/src/mobs/tame.rs @@ -388,7 +388,12 @@ impl Goal for OwnerHurtBy { if !m.extra.tame || m.extra.sitting { return false; } - let Some((who, at)) = cx.w.player.as_ref().and_then(|p| p.hurt_by) else { + let Some((who, at)) = + cx.w.player + .as_ref() + .filter(|p| m.extra.owner == Some(p.uuid)) + .and_then(|p| p.hurt_by) + else { return false; }; at != self.timestamp && wants_to_attack(m, cx.w, who) @@ -399,7 +404,12 @@ impl Goal for OwnerHurtBy { .is_some_and(|t| t.alive) } fn start(&mut self, m: &mut Mob, cx: &mut Cx) { - if let Some((who, at)) = cx.w.player.as_ref().and_then(|p| p.hurt_by) { + if let Some((who, at)) = + cx.w.player + .as_ref() + .filter(|p| m.extra.owner == Some(p.uuid)) + .and_then(|p| p.hurt_by) + { m.ai.target = Some(who); self.timestamp = at; } @@ -422,7 +432,12 @@ impl Goal for OwnerHurt { if !m.extra.tame || m.extra.sitting { return false; } - let Some((who, at)) = cx.w.player.as_ref().and_then(|p| p.last_hurt) else { + let Some((who, at)) = + cx.w.player + .as_ref() + .filter(|p| m.extra.owner == Some(p.uuid)) + .and_then(|p| p.last_hurt) + else { return false; }; at != self.timestamp && wants_to_attack(m, cx.w, who) @@ -433,7 +448,12 @@ impl Goal for OwnerHurt { .is_some_and(|t| t.alive) } fn start(&mut self, m: &mut Mob, cx: &mut Cx) { - if let Some((who, at)) = cx.w.player.as_ref().and_then(|p| p.last_hurt) { + if let Some((who, at)) = + cx.w.player + .as_ref() + .filter(|p| m.extra.owner == Some(p.uuid)) + .and_then(|p| p.last_hurt) + { m.ai.target = Some(who); self.timestamp = at; }