From 57494e6871fde1832e4b2845bca4b3dbafc8a5a9 Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Tue, 27 Oct 2026 22:18:26 +0100 Subject: [PATCH] Slow mobs in cobwebs again WebBlock.entityInside makes a mob stuck at 0.25/0.05/0.25 (0.5/0.25/0.5 with Weaving) and ends its fall; spiders and withers ignore it. The block-effects pass replaced the earlier cobweb code and dropped it. --- crates/horizon-client/src/mobs/ai.rs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/crates/horizon-client/src/mobs/ai.rs b/crates/horizon-client/src/mobs/ai.rs index eaadf14a4..ea9119fd4 100644 --- a/crates/horizon-client/src/mobs/ai.rs +++ b/crates/horizon-client/src/mobs/ai.rs @@ -533,9 +533,9 @@ pub fn tick( true } /// `LivingEntity.aiStep` -> `Entity.applyEffectsFromBlocks` for the blocks -/// that hurt or hold a mob: the cactus (`CactusBlock.entityInside`, 1) and the -/// sweet berry bush (`SweetBerryBushBlock.entityInside`: stuck at 0.8, 0.75, -/// 0.8, and a grown bush pricks for 1 when the mob moved at least 0.003 on X +/// that hurt or hold a mob: the cactus (`CactusBlock.entityInside`, 1), the +/// cobweb (stuck at 0.25, 0.05, 0.25) and the sweet berry bush +/// (`SweetBerryBushBlock.entityInside`: stuck at 0.8, 0.75, 0.8, and a grown bush pricks for 1 when the mob moved at least 0.003 on X /// or Z this tick). The blocks are those the mob's box touches anywhere along /// its move this tick, from where it started to where it ended. fn effects_from_blocks(m: &mut Mob, w: &MobWorld) { @@ -562,6 +562,21 @@ fn effects_from_blocks(m: &mut Mob, w: &MobWorld) { "minecraft:cactus" => { m.damage(1.0, Damage::of(DamageKind::Cactus)); } + // WebBlock.entityInside -> makeStuckInBlock, which a + // spider ignores for cobwebs and a wither always. + "minecraft:cobweb" + if !matches!( + m.species(), + Species::Spider | Species::CaveSpider | Species::Wither + ) => + { + m.fall_distance = 0.0; + m.stuck_multiplier = if m.has_effect("minecraft:weaving") { + Vec3::new(0.5, 0.25, 0.5) + } else { + Vec3::new(0.25, f64::from(0.05_f32), 0.25) + }; + } "minecraft:sweet_berry_bush" if !matches!(m.species(), Species::Fox | Species::Bee) => {