From a44581eaf39a1775b79e5ee450f7a0fab1dc9347 Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Mon, 26 Oct 2026 19:14:23 +0100 Subject: [PATCH] Let a shulker bullet's levitation run out on mobs --- crates/horizon-client/src/game/creatures.rs | 2 +- crates/horizon-client/src/mobs.rs | 1 - crates/horizon-client/src/mobs/living.rs | 10 ++++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/horizon-client/src/game/creatures.rs b/crates/horizon-client/src/game/creatures.rs index 2b65a3289..3d16faae9 100644 --- a/crates/horizon-client/src/game/creatures.rs +++ b/crates/horizon-client/src/game/creatures.rs @@ -2385,7 +2385,7 @@ impl Game<'_> { if let Some(m) = self.mobs.iter_mut().find(|m| m.id == id) && m.damage(4.0, source) { - m.extra.levitation = 200; + m.add_effect("minecraft:levitation", 200, 0); } } }, diff --git a/crates/horizon-client/src/mobs.rs b/crates/horizon-client/src/mobs.rs index 00c21633e..631ef40eb 100644 --- a/crates/horizon-client/src/mobs.rs +++ b/crates/horizon-client/src/mobs.rs @@ -677,7 +677,6 @@ pub struct Extra { pub anger: i32, pub carried: Option, pub charged: bool, - pub levitation: i32, /// Held item ids (main hand, off hand) and head item. pub main_hand: Option>, pub off_hand: Option>, diff --git a/crates/horizon-client/src/mobs/living.rs b/crates/horizon-client/src/mobs/living.rs index 394821ace..ddb25d877 100644 --- a/crates/horizon-client/src/mobs/living.rs +++ b/crates/horizon-client/src/mobs/living.rs @@ -742,8 +742,14 @@ impl Mob { movement.y = 0.2; } let mut y = movement.y; - if self.extra.levitation > 0 { - y += (0.05 * 1.0 - movement.y) * 0.2; + // LivingEntity.travelInAir: levitation lifts by its amplifier. + if let Some(&(_, _, amp)) = self + .extra + .effects + .iter() + .find(|e| e.0 == "minecraft:levitation") + { + y += (0.05 * f64::from(amp + 1) - movement.y) * 0.2; } else { y -= self.gravity(); }