Skip to content

Minecraft: Java Edition 26.3 rewritten from scratch in Rust, checked against vanilla with 281 differential harnesses. Get it with the Horizon launcher.

Take a seat instead of sweeping to it

MSedgeMC0a0c2fd5f104
diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs
index 86e8a824f..3afe1d1bf 100644
--- a/crates/horizon-client/src/game.rs
+++ b/crates/horizon-client/src/game.rs
@@ -2642,6 +2642,10 @@ struct Game<'a> {
cart_models: minecarts::CartModels,
/// The boat the player rides.
riding: Option<u32>,
+ /// The mount the last `position_rider` put the player on, to tell the tick
+ /// a seat is taken (`Entity.moveTo`, no camera sweep) from the ones that
+ /// follow it (`positionRider`, interpolated as usual).
+ posed_rider: Option<u32>,
/// The vehicle the player's file names, waiting for it to be in the world
/// (`ServerPlayer.loadAndSpawnParentVehicle`).
pending_vehicle: Option<[i32; 4]>,
@@ -18320,6 +18324,7 @@ impl<'a> Game<'a> {
trim_slots: Vec::new(),
cart_models: prepared.cart_models,
riding: None,
+ posed_rider: None,
pending_vehicle: None,
ender_items: vec![None; 27],
ender_open: None,
diff --git a/crates/horizon-client/src/game/mounts.rs b/crates/horizon-client/src/game/mounts.rs
index ac21ac000..37593c04b 100644
--- a/crates/horizon-client/src/game/mounts.rs
+++ b/crates/horizon-client/src/game/mounts.rs
@@ -536,8 +536,14 @@ impl Game<'_> {
let rear = Vec3::new(rear[0], rear[1], rear[2])
.rotate_y(-m.yaw * (std::f64::consts::PI / 180.0) as f32);
at = Vec3::new(at.x + rear.x, at.y + rear.y, at.z + rear.z);
+ // The tick a rider takes its seat is a teleport (`Entity.moveTo`), which
+ // sets the old position too: the camera must not sweep from where the
+ // player stood to the seat. The ticks after it move with the mount and
+ // are interpolated as usual.
+ let first = self.posed_rider != self.riding;
+ self.posed_rider = self.riding;
if let Some(p) = self.player.as_mut() {
- self.previous_position = p.position;
+ self.previous_position = if first { at } else { p.position };
p.position = at;
p.velocity = Vec3::ZERO;
p.fall_distance = 0.0;
diff --git a/crates/horizon-client/src/game/remote_vehicles.rs b/crates/horizon-client/src/game/remote_vehicles.rs
index 650870105..6c55b6bbd 100644
--- a/crates/horizon-client/src/game/remote_vehicles.rs
+++ b/crates/horizon-client/src/game/remote_vehicles.rs
@@ -237,9 +237,17 @@ impl Game<'_> {
cart
};
if let Some(p) = self.player.as_mut() {
- self.previous_position = p.position;
+ // The tick a rider takes its seat is a teleport (`Entity.moveTo`,
+ // which sets the old position too): the camera must not sweep from
+ // where the player stood to the cushion, boat or cart. The ticks
+ // after it move with the vehicle and interpolate as usual.
+ let first = self.posed_rider != self.riding;
+ self.posed_rider = self.riding;
if let Some(v) = seat {
+ self.previous_position = if first { v } else { p.position };
p.position = v;
+ } else {
+ self.previous_position = p.position;
}
p.velocity = Vec3::ZERO;
p.fall_distance = 0.0;