[PR #6673] [MERGED] Elytra: a wall hit hurts by the speed the client flew #7028

Closed
opened 2026-11-03 06:32:22 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6673
Author: @JustKarkat
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: fix/elytra-wall-damage


📝 Commits (1)

  • 0d8198d A glide's wall hit hurts by the speed the client flew

📊 Changes

2 files changed (+71 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game/lan_actions.rs (+7 -0)
📝 crates/horizon-client/src/motion.rs (+64 -0)

📄 Description

Fixes #6494

Cause. The only side that computes elytra wall damage is the server's copy (Entity.move → LivingEntity.handleFallFlyingCollisions runs off !isClientSide), and that copy never travels with the client's velocity. ServerGamePacketListenerImpl.handleMovePlayer moves its body; PlayerMotion::server_travel then runs from whatever delta movement the copy last had. Measured on a live single-player glide with the 6494 instrumentation:

copy velocity at the wall
client (client_side = true, skips the damage, as vanilla does) (-1.56, 0.06, 0.58) ≈ 1.67 blocks/tick
server (server_copy = true, the one that must hurt) (-0.19, -0.15, 0.16) ≈ 0.24 blocks/tick

handleFallFlyingCollisions reads that as the speed the glide lost — (moveHorLength - new) * 10 - 3 — so with 0.24 it stayed negative and no wall hit ever hurt. Turning made it worse because the flight model's 0.1 pull keeps re-growing the copy's drift.

Fix. Carry the tick's movement into the copy's delta movement before server_travel, as handleMovePlayer does (PlayerMotion::carry_client_movement, only while fall_flying, so nothing else changes). The same live glide then logged move_h=5.07 new_h=0.83 dmg=39.32 instead of a negative value — a real hit for that speed, as vanilla inverts.

Test. a_glide_into_a_wall_hurts_by_the_speed_it_lost in motion.rs: a glide at 1.2 blocks a tick into a stone wall hurts by minecraft:fly_into_wall and drops health. It fails with the seeding removed and passes with it. Full horizon-client-lib suite: 1286 passed, 0 failed, 40 ignored; clippy clean on both crates.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/6673 **Author:** [@JustKarkat](https://github.com/JustKarkat) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/elytra-wall-damage` --- ### 📝 Commits (1) - [`0d8198d`](https://github.com/horizon-rust/horizon/commit/0d8198d62d5352d8d8ea33914b3735445603e462) A glide's wall hit hurts by the speed the client flew ### 📊 Changes **2 files changed** (+71 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan_actions.rs` (+7 -0) 📝 `crates/horizon-client/src/motion.rs` (+64 -0) </details> ### 📄 Description Fixes #6494 **Cause.** The only side that computes elytra wall damage is the server's copy (`Entity.move` → `LivingEntity.handleFallFlyingCollisions` runs off `!isClientSide`), and that copy never travels with the client's velocity. `ServerGamePacketListenerImpl.handleMovePlayer` moves its body; `PlayerMotion::server_travel` then runs from whatever delta movement the copy last had. Measured on a live single-player glide with the 6494 instrumentation: | copy | velocity at the wall | |---|---| | client (`client_side = true`, skips the damage, as vanilla does) | `(-1.56, 0.06, 0.58)` ≈ 1.67 blocks/tick | | server (`server_copy = true`, the one that must hurt) | `(-0.19, -0.15, 0.16)` ≈ 0.24 blocks/tick | `handleFallFlyingCollisions` reads that as the speed the glide lost — `(moveHorLength - new) * 10 - 3` — so with 0.24 it stayed negative and no wall hit ever hurt. Turning made it worse because the flight model's 0.1 pull keeps re-growing the copy's drift. **Fix.** Carry the tick's movement into the copy's delta movement before `server_travel`, as `handleMovePlayer` does (`PlayerMotion::carry_client_movement`, only while `fall_flying`, so nothing else changes). The same live glide then logged `move_h=5.07 new_h=0.83 dmg=39.32` instead of a negative value — a real hit for that speed, as vanilla inverts. **Test.** `a_glide_into_a_wall_hurts_by_the_speed_it_lost` in `motion.rs`: a glide at 1.2 blocks a tick into a stone wall hurts by `minecraft:fly_into_wall` and drops health. It fails with the seeding removed and passes with it. Full `horizon-client-lib` suite: 1286 passed, 0 failed, 40 ignored; clippy clean on both crates. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:32:22 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#7028
No description provided.