[PR #5602] [MERGED] Cushions: breaking the one you sit on leaves you on the floor #6381

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5602
Author: @rdbtCVS
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/4571-cushion-break-dismount


📝 Commits (1)

  • 0fde32c Cushions: breaking the one you sit on leaves you on the floor

📊 Changes

3 files changed (+94 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/cushions.rs (+44 -1)
📝 crates/horizon-client/src/game/remote_objects.rs (+11 -0)
📝 tools/lan_e2e.py (+39 -0)

📄 Description

🤖 Opened by rdbtCVS's AI agent (Claude Code, Claude Opus 5.5), not by rdbtCVS personally.

Breaking a cushion you sit on dropped you one block into the floor.

Why: a seated player is at Cushion.seat(), 0.35 below the cushion. break_cushion only cleared riding, so the rider stayed at the seat height, which is inside the block under it. On the server thread it was worse: the client kept riding the removed cushion (no SetPassengers comes for another player's or an explosion's break), and remote_ride held it at the stale seat.

Vanilla: Entity.setRemoved → each passenger's stopRiding → LivingEntity.dismountVehicle(vehicle). For a removed vehicle that is (getX(), max(getY(), vehicle.getY()), getZ()), then, for an entity no bigger than 4×4, findFreePosition within the rider's own box around that spot. Cushion.removePassenger plays entity.cushion.get_up only when getRemovalReason() == null, so a broken cushion plays no get-up sound.

Change:

  • cushions.rs: dismount_removed_vehicle(vehicle_y) does that branch of dismountVehicle, with portal_travel::find_free_position against block collisions and the border. break_cushion calls it for the cushion's rider. A guest who breaks its own cushion runs this inside as_guest, so the server moves it and teleports the client.
  • remote_objects.rs: when a server removes the cushion the client rides, the client dismounts the same way. This covers a cushion broken by someone else, by an explosion, or because it lost its support.
  • tools/lan_e2e.py: new check cushion_break_seated. The host and the guest each sit on a cushion and break it while seated, then the check asserts they stand on the floor, not riding.

Fixes #4571

Tests

  • python3 tools/lan_e2e.py --check cushion_break_seated (server thread): passes, both end at the cushion's height (y 65.0). Without the fix it fails: the host ends at y 64.0, one block down, which is the bug.
  • cargo clippy -p horizon-client --all-targets -- -D warnings: clean. cargo test -p horizon-client --lib --bins --tests: all pass (1084 + 443 + integration).
  • tools/pr_ready.py --quick: Public tree, Python tests (510), rustfmt and doc tests pass. Its clippy and test rows failed on a stale horizon-assets artifact in the shared target dir (enchantment_in_tag not in ItemEnv, a file this PR doesn't touch). After a touch, I reran both by hand and they pass (above). Parity: 364 harnesses left to CI.
  • Note: the existing cushions LAN check already fails on main, before this change. Its second cushion placement doesn't happen. That is not related to this PR, so I left it alone.

🤖 Generated with Claude Code


🔄 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/5602 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/4571-cushion-break-dismount` --- ### 📝 Commits (1) - [`0fde32c`](https://github.com/horizon-rust/horizon/commit/0fde32cb82aaae30071b2e630ce3372954a14581) Cushions: breaking the one you sit on leaves you on the floor ### 📊 Changes **3 files changed** (+94 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/cushions.rs` (+44 -1) 📝 `crates/horizon-client/src/game/remote_objects.rs` (+11 -0) 📝 `tools/lan_e2e.py` (+39 -0) </details> ### 📄 Description > 🤖 Opened by rdbtCVS's AI agent (Claude Code, Claude Opus 5.5), not by rdbtCVS personally. Breaking a cushion you sit on dropped you one block into the floor. **Why:** a seated player is at `Cushion.seat()`, 0.35 below the cushion. `break_cushion` only cleared `riding`, so the rider stayed at the seat height, which is inside the block under it. On the server thread it was worse: the client kept `riding` the removed cushion (no `SetPassengers` comes for another player's or an explosion's break), and `remote_ride` held it at the stale seat. **Vanilla:** `Entity.setRemoved` → each passenger's `stopRiding` → `LivingEntity.dismountVehicle(vehicle)`. For a removed vehicle that is `(getX(), max(getY(), vehicle.getY()), getZ())`, then, for an entity no bigger than 4×4, `findFreePosition` within the rider's own box around that spot. `Cushion.removePassenger` plays `entity.cushion.get_up` only when `getRemovalReason() == null`, so a broken cushion plays no get-up sound. **Change:** - `cushions.rs`: `dismount_removed_vehicle(vehicle_y)` does that branch of `dismountVehicle`, with `portal_travel::find_free_position` against block collisions and the border. `break_cushion` calls it for the cushion's rider. A guest who breaks its own cushion runs this inside `as_guest`, so the server moves it and teleports the client. - `remote_objects.rs`: when a server removes the cushion the client rides, the client dismounts the same way. This covers a cushion broken by someone else, by an explosion, or because it lost its support. - `tools/lan_e2e.py`: new check `cushion_break_seated`. The host and the guest each sit on a cushion and break it while seated, then the check asserts they stand on the floor, not riding. Fixes #4571 **Tests** - `python3 tools/lan_e2e.py --check cushion_break_seated` (server thread): passes, both end at the cushion's height (y 65.0). **Without the fix it fails:** the host ends at y 64.0, one block down, which is the bug. - `cargo clippy -p horizon-client --all-targets -- -D warnings`: clean. `cargo test -p horizon-client --lib --bins --tests`: all pass (1084 + 443 + integration). - `tools/pr_ready.py --quick`: Public tree, Python tests (510), rustfmt and doc tests pass. Its clippy and test rows failed on a stale `horizon-assets` artifact in the shared target dir (`enchantment_in_tag` not in `ItemEnv`, a file this PR doesn't touch). After a `touch`, I reran both by hand and they pass (above). Parity: 364 harnesses left to CI. - Note: the existing `cushions` LAN check already fails on main, before this change. Its second cushion placement doesn't happen. That is not related to this PR, so I left it alone. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:19:34 +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#6381
No description provided.