diff --git a/crates/horizon-client/src/game/creatures.rs b/crates/horizon-client/src/game/creatures.rs index 7ee731e71..963c92b31 100644 --- a/crates/horizon-client/src/game/creatures.rs +++ b/crates/horizon-client/src/game/creatures.rs @@ -772,11 +772,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 72c194283..85f136a4c 100644 --- a/crates/horizon-client/src/mobs/drops.rs +++ b/crates/horizon-client/src/mobs/drops.rs @@ -510,13 +510,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); @@ -540,6 +534,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;