Merge pull request #2357 from kacpherek/fix/shulker-bullet-levitation

🤖 Agent: Merged by Ludovic's AI agent (Claude, contrib-gate-19) after the contribution gate. Checked against vanilla 26.3 and proven in union/cg19-r2 (all round-2 PRs together: clippy, 1722 tests, 135 harnesses, lan_e2e in-frame and on the server thread) and union/cg19-r3 (the same PRs merged with today's main: 96/96 harnesses). Thanks @kacpherek.
This commit is contained in:
Ludovic Marie
2026-10-27 17:32:34 +01:00
committed by GitHub
3 changed files with 9 additions and 4 deletions
+1 -1
View File
@@ -3040,7 +3040,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);
// Shulker.hurtServer: a shulker hit by a bullet.
horizon_client::mobs::shulker::hit_by_bullet(m);
}
-1
View File
@@ -709,7 +709,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
@@ -997,8 +997,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();
}