From 849b5b663bbeb3cf04326b5726df1e2e57be38cf Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Mon, 26 Oct 2026 19:33:09 +0100 Subject: [PATCH] Let a sculk catalyst take the experience of mobs killed without a player --- crates/horizon-client/src/game/creatures.rs | 5 +++-- crates/horizon-client/src/mobs/drops.rs | 18 +++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/crates/horizon-client/src/game/creatures.rs b/crates/horizon-client/src/game/creatures.rs index d192a2b02..36bd1150a 100644 --- a/crates/horizon-client/src/game/creatures.rs +++ b/crates/horizon-client/src/game/creatures.rs @@ -685,11 +685,12 @@ impl Game<'_> { let by_player = killer.is_some() || m.ai.last_hurt_by_player > 0; let mut dying = m.clone(); // LivingEntity.die: the death is heard, and a sculk catalyst nearby - // takes the experience (before the loot is dropped). + // takes the experience (before the loot is dropped). It takes what + // would drop, whoever killed the mob. self.sculk_mob_died(m); let consumed = self.catalyst_takes_experience([m.position.x, m.position.y, m.position.z], |_| { - if by_player { + if horizon_client::mobs::drops::drops_experience(&dying) { horizon_client::mobs::drops::base_experience(&mut dying).max(0) as u32 } else { 0 diff --git a/crates/horizon-client/src/mobs/drops.rs b/crates/horizon-client/src/mobs/drops.rs index c7b1c77e1..d1b0e8b9a 100644 --- a/crates/horizon-client/src/mobs/drops.rs +++ b/crates/horizon-client/src/mobs/drops.rs @@ -471,13 +471,7 @@ pub fn die(m: &mut Mob, d: &Death, sequences: &mut RandomSequences) -> (Vec false, - Species::Hoglin => true, - s if is_monster(s) => true, - _ => !m.is_baby(), - }; - if killed_by_player && drops_experience && d.mob_drops { + if killed_by_player && drops_experience(m) && d.mob_drops { let mut amount = base_experience(m); while amount > 0 { let value = orb_value(amount); @@ -501,6 +495,16 @@ fn roll( None => Vec::new(), } } +/// `LivingEntity.shouldDropExperience`: babies drop none, except monsters and +/// hoglins; tadpoles never do. +pub fn drops_experience(m: &Mob) -> bool { + match m.species() { + Species::Tadpole => false, + Species::Hoglin => true, + s if is_monster(s) => true, + _ => !m.is_baby(), + } +} /// `getBaseExperienceReward` (no vanilla enchantment changes mob experience). pub fn base_experience(m: &mut Mob) -> i32 { use Species as S;