Merge pull request #1184 from ludovic111/fix/dedicated-server-waits
🤖 Agent: merged after integration wave 2 on the desktop (integ/w2 @ 38307d15 = main c16b41ab + this wave): fmt, clippy -D warnings, workspace + launcher + telemetry-server tests, release build and every affected parity harness pass; the 3 harness failures and the panel test passed on rerun (known flakes).
This commit is contained in:
@@ -2107,15 +2107,22 @@ impl Game<'_> {
|
||||
let from = pl.position;
|
||||
self.spawn_mob("minecraft:endermite", [from.x, from.y, from.z], false);
|
||||
}
|
||||
// To where the pearl started its last tick (oldPosition).
|
||||
let to = p.previous;
|
||||
if let Some(pl) = self.player.as_mut() {
|
||||
pl.position = at;
|
||||
pl.position = to;
|
||||
pl.velocity = Vec3::ZERO;
|
||||
pl.fall_distance = 0.0;
|
||||
pl.teleported = true;
|
||||
}
|
||||
self.previous_position = at;
|
||||
self.previous_position = to;
|
||||
self.hurt_player_by("minecraft:ender_pearl", 5.0);
|
||||
self.audio
|
||||
.play("minecraft:entity.player.teleport", Some(atp), 1.0, 1.0);
|
||||
self.audio.play(
|
||||
"minecraft:entity.player.teleport",
|
||||
Some([to.x, to.y, to.z]),
|
||||
1.0,
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
}
|
||||
(ProjectileKind::SmallFireball, hit) => match hit {
|
||||
|
||||
@@ -532,12 +532,14 @@ impl Game<'_> {
|
||||
g.health = m.health.health();
|
||||
g.food = m.health.food.food;
|
||||
g.saturation = m.health.food.saturation;
|
||||
// A teleport (commands) moves the guest.
|
||||
// A teleport (commands, a pearl) moves the guest; a pearl's is
|
||||
// sent even to where they stand (ServerPlayer.teleport).
|
||||
let at = [m.position.x, m.position.y, m.position.z];
|
||||
m.sprinting = false;
|
||||
let teleported = std::mem::take(&mut m.teleported);
|
||||
let moved: f64 = (0..3).map(|k| (at[k] - g.position[k]).powi(2)).sum();
|
||||
g.motion = Some(Box::new(m));
|
||||
if moved > 0.0001 || turned {
|
||||
if moved > 0.0001 || turned || teleported {
|
||||
host.hub.teleport(i, Some(at));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,6 +270,10 @@ pub struct PlayerMotion {
|
||||
pub steps: MovementDistances,
|
||||
pub needs_sync: bool,
|
||||
pub sync_position: bool,
|
||||
/// Moved by an ender pearl (`ServerPlayer.teleport`): a server sends the
|
||||
/// position packet even when the player lands where they stood. The
|
||||
/// server takes it at the end of a guest's turn.
|
||||
pub teleported: bool,
|
||||
pub events: Vec<MotionEvent>,
|
||||
pub attributes: LiveAttributes<Box<dyn FnMut() -> i32>>,
|
||||
pub impulse: ImpulseContext,
|
||||
@@ -440,6 +444,7 @@ impl PlayerMotion {
|
||||
},
|
||||
needs_sync: false,
|
||||
sync_position: false,
|
||||
teleported: false,
|
||||
events: Vec::new(),
|
||||
attributes,
|
||||
fluids: PlayerFluids::default(),
|
||||
|
||||
Reference in New Issue
Block a user