From 992c63eefbd931899499f27daaf308a82931946a Mon Sep 17 00:00:00 2001 From: iLostName <55976057+iLostName@users.noreply.github.com> Date: Wed, 28 Oct 2026 06:09:21 +0100 Subject: [PATCH] death message: a creeper's blast names the creeper, not the last mob that hit The creeper is out of the mob list when its blast lands, so its name now comes with the explosion event. Fixes #2978. --- crates/horizon-client/src/game/creatures.rs | 8 ++++++-- crates/horizon-client/src/mobs.rs | 4 +++- crates/horizon-client/src/mobs/hostile.rs | 8 ++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/crates/horizon-client/src/game/creatures.rs b/crates/horizon-client/src/game/creatures.rs index f7d4828f1..a65213479 100644 --- a/crates/horizon-client/src/game/creatures.rs +++ b/crates/horizon-client/src/game/creatures.rs @@ -1193,14 +1193,18 @@ impl Game<'_> { owner, } => self.add_fangs(at, yaw, delay, owner), MobEvent::Shoot(..) => {} - MobEvent::ExplosionSource { mob, charged } => { + MobEvent::ExplosionSource { mob, charged, name } => { self.combat.explosion_source = Some(mob); + // The creeper causes the blast's damage, but it is out of + // the mob list already: its name comes with the event. + self.note_named_attacker("minecraft:explosion", mob, name); if charged { self.combat.charged_exploders.push(mob); } } MobEvent::Explode(at, radius, species) => { // The exploding mob causes the damage (Creeper.explodeCreeper). + let noted = self.combat.explosion_source.is_some(); let source_mob = self.combat.explosion_source.or_else(|| { self.mobs .iter() @@ -1211,7 +1215,7 @@ impl Game<'_> { .map(|m| m.id) .next() }); - if let Some(id) = source_mob { + if !noted && let Some(id) = source_mob { self.note_attacker("minecraft:explosion", id); } self.combat.explosion_source = source_mob; diff --git a/crates/horizon-client/src/mobs.rs b/crates/horizon-client/src/mobs.rs index 5d3b8dfc1..4ba2ba988 100644 --- a/crates/horizon-client/src/mobs.rs +++ b/crates/horizon-client/src/mobs.rs @@ -1108,10 +1108,12 @@ pub enum MobEvent { /// The mob the `Explode` right after this comes from /// (`ServerExplosion.source`), and whether it is a charged creeper: the /// exploding creeper is already out of the mob list when the game applies - /// the blast, so its victims' loot cannot look it up. + /// the blast, so its victims' loot cannot look it up, nor the death + /// message its name (`name`, `getDisplayName`). ExplosionSource { mob: u32, charged: bool, + name: crate::text::Text, }, /// The centre, the radius and the kind of the mob blowing up (it may be /// gone from the list by the time the blast is handled). diff --git a/crates/horizon-client/src/mobs/hostile.rs b/crates/horizon-client/src/mobs/hostile.rs index e5c7b6a93..1e3df33a9 100644 --- a/crates/horizon-client/src/mobs/hostile.rs +++ b/crates/horizon-client/src/mobs/hostile.rs @@ -326,9 +326,17 @@ pub fn creeper_tick(m: &mut Mob, events: &mut Vec) { if m.swell >= 30 { m.swell = 30; let radius = if m.extra.charged { 6.0 } else { 3.0 }; + let name = match &m.custom_name { + Some(name) => crate::text::Text::literal(name.clone()), + None => crate::text::Text::translate( + &format!("entity.{}", m.kind.id.replace(':', ".")), + &[], + ), + }; events.push(MobEvent::ExplosionSource { mob: m.id, charged: m.extra.charged, + name, }); events.push(MobEvent::Explode( [m.position.x, m.position.y, m.position.z],