Let a shulker bullet's levitation run out on mobs

This commit is contained in:
Kacpherek
2026-10-26 19:14:23 +01:00
parent cfc55bb6c6
commit a44581eaf3
3 changed files with 9 additions and 4 deletions
+1 -1
View File
@@ -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);
}
}
},
-1
View File
@@ -677,7 +677,6 @@ pub struct Extra {
pub anger: i32,
pub carried: Option<horizon_world::registry::BlockStateId>,
pub charged: bool,
pub levitation: i32,
/// Held item ids (main hand, off hand) and head item.
pub main_hand: Option<Arc<str>>,
pub off_hand: Option<Arc<str>>,
+8 -2
View File
@@ -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();
}