Merge pull request #2145 from kacpherek/fix/mob-griefing-explosions-endermen

🤖 Agent: Gate check by Ludovic's AI agent (Claude). Checked against 26.3: `ServerLevel.explode` turns `ExplosionInteraction.MOB` into KEEP when `mob_griefing` is off, and `EnderMan`'s take and leave block goals need the rule too. Gate: this wave's 55 PRs merged on main in one tree: clippy `-D warnings` clean, 1186 horizon-client and 163 horizon-world tests pass, and of the 101 harnesses `parity.py --changed-files` picked, 100 pass (`block_removal` failed on one spawner case from #2199's orb merging, fixed there). `lan_e2e.py` passes 24 checks with the host on its server thread and in-frame (chest, xp, pvp, doors, villagers, beds, frames, projectiles, arrows, fishing, damage, mobs, blast, drops, elytra, breath, predict, cracks, barter, kills, hurt, contacts, underwater, plates), plus forced-levels on the server thread. Thanks @kacpherek!
This commit is contained in:
Ludovic Marie
2026-10-26 19:22:10 +01:00
committed by GitHub
2 changed files with 21 additions and 12 deletions
+11 -8
View File
@@ -7875,15 +7875,18 @@ impl Game<'_> {
}
}
/// ServerExplosion: rays from a 16^3 grid lose (resistance + 0.3) * 0.3 per step.
/// A mob explosion (`Level.ExplosionInteraction.MOB`: drop decay with the
/// default mobGriefing rule).
/// A mob explosion (`ServerLevel.explode` with `ExplosionInteraction.MOB`:
/// blocks are kept without mobGriefing, else the mob_explosion_drop_decay
/// rule picks decay).
fn explode(&mut self, center: [f64; 3], radius: f32) -> Result<()> {
self.server_explode(
center,
radius,
explosion::BlockInteraction::DestroyWithDecay,
false,
)
let interaction = if !self.ui.rules.bool("mob_griefing") {
explosion::BlockInteraction::Keep
} else if self.ui.rules.bool("mob_explosion_drop_decay") {
explosion::BlockInteraction::DestroyWithDecay
} else {
explosion::BlockInteraction::Destroy
};
self.server_explode(center, radius, interaction, false)
}
/// Copies of a save batch carrying its live block entities and save data.
fn with_entities<'a>(
+10 -4
View File
@@ -331,8 +331,11 @@ impl Goal for TakeBlock {
fn flags(&self) -> u8 {
0
}
fn can_use(&mut self, m: &mut Mob, _: &mut Cx) -> bool {
m.extra.carried.is_none() && m.random.next_int_bound(reduced(20)).unwrap_or(1) == 0
fn can_use(&mut self, m: &mut Mob, cx: &mut Cx) -> bool {
// EndermanTakeBlockGoal.canUse: needs mobGriefing, checked before the draw.
m.extra.carried.is_none()
&& cx.w.mob_griefing
&& m.random.next_int_bound(reduced(20)).unwrap_or(1) == 0
}
fn tick(&mut self, m: &mut Mob, cx: &mut Cx) {
let x = (m.position.x - 2.0 + m.random.next_double() * 4.0).floor() as i32;
@@ -379,8 +382,11 @@ impl Goal for LeaveBlock {
fn flags(&self) -> u8 {
0
}
fn can_use(&mut self, m: &mut Mob, _: &mut Cx) -> bool {
m.extra.carried.is_some() && m.random.next_int_bound(reduced(2000)).unwrap_or(1) == 0
fn can_use(&mut self, m: &mut Mob, cx: &mut Cx) -> bool {
// EndermanLeaveBlockGoal.canUse: needs mobGriefing, checked before the draw.
m.extra.carried.is_some()
&& cx.w.mob_griefing
&& m.random.next_int_bound(reduced(2000)).unwrap_or(1) == 0
}
fn tick(&mut self, m: &mut Mob, cx: &mut Cx) {
let Some(carried) = m.extra.carried else {