[PR #1416] [MERGED] Beds: respawning checks the bed and stands up beside it, else the world spawn #3507

Closed
opened 2026-11-03 04:10:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1416
Author: @ludovic111
Created: 10/23/2026
Status: ✅ Merged
Merged: 10/23/2026
Merged by: @ludovic111

Base: main ← Head: fix/bed-respawn


📝 Commits (10+)

  • 7acebba Server players: the HUD's bubbles and golden hearts follow the server, absorption is saved, Nether lava pushes harder
  • ed28e1d Contact damage: magma, cactus, lit campfires and sweet berry bushes hurt in both modes
  • 2898b40 Server players: an axe-disabled shield stays down 5 s, death forgets the digging
  • 5c4600e /setworldspawn moves the world spawn, not the player's respawn point
  • 65bd2d0 Items push out of blocks; a server's client digs at the server's speed
  • feeefb3 Mobs: a punch shows smooth and slow, as on vanilla's client
  • f949f08 Merge remote-tracking branch 'origin/main' into fix/server-air-absorption
  • 10f6b18 Merge branch 'fix/server-air-absorption' into fix/contact-damage
  • 48c1b04 Merge branch 'fix/contact-damage' into fix/server-player-shield-mining
  • e84f86a Merge branch 'fix/server-player-shield-mining' into fix/setworldspawn

📊 Changes

33 files changed (+1961 additions, -139 deletions)

View changed files

📝 crates/horizon-client/src/attribute_updates.rs (+5 -0)
📝 crates/horizon-client/src/entities.rs (+73 -5)
📝 crates/horizon-client/src/game.rs (+38 -19)
📝 crates/horizon-client/src/game/agent.rs (+5 -0)
📝 crates/horizon-client/src/game/commands.rs (+14 -1)
📝 crates/horizon-client/src/game/dispense_fixture.rs (+6 -6)
📝 crates/horizon-client/src/game/dragon.rs (+1 -0)
📝 crates/horizon-client/src/game/end.rs (+19 -2)
📝 crates/horizon-client/src/game/lan.rs (+10 -0)
📝 crates/horizon-client/src/game/lan_actions.rs (+93 -2)
📝 crates/horizon-client/src/game/lan_entities.rs (+1 -0)
📝 crates/horizon-client/src/game/remote.rs (+148 -46)
📝 crates/horizon-client/src/game/respawn_anchor.rs (+96 -3)
📝 crates/horizon-client/src/game/server_travel.rs (+21 -10)
📝 crates/horizon-client/src/lan/entity.rs (+37 -2)
📝 crates/horizon-client/src/lan/guest.rs (+9 -0)
📝 crates/horizon-client/src/lan/hub.rs (+25 -1)
📝 crates/horizon-client/src/lan/playerdata.rs (+13 -1)
📝 crates/horizon-client/src/mobs.rs (+7 -0)
📝 crates/horizon-client/src/mobs/living.rs (+3 -0)

...and 13 more files

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Last in a chain: #1407 → #1408 → #1409 → #1410 → #1411 → #1412 → this. Each branch merges the one before it, so this PR also shows their commits until they merge. This PR's own change: https://github.com/ludovic111/horizon/compare/fix/mob-knockback-view...fix/bed-respawn (one commit, 11 files, +335 −53).

What

#1308 Removed or blocked beds are no longer valid respawn points, as in vanilla 26.3.

  • Setting the point: a bed sets the respawn point the way ServerPlayer.startSleepInBed does: once the player is in reach, day or night. The point is a RespawnConfig at the bed's head, with the player's yaw (wrapped as RespawnData.of does), not forced. Straw beds never set it (straw_bed_rule). Before, a bed stored a raw position, which respawning used without looking at the block.
  • Respawning: findRespawnAndUseSpawnBlock now handles beds:
    • It uses AbstractBedBlock.findStandUpPosition through DismountHelper. The player stands beside the bed on the side away from the yaw it was set from, then around it, then on it, with bunk beds handled too. The player faces the bed.
    • A bed that is gone or boxed in sends the player to the world spawn with "You have no home bed or charged respawn anchor, or it was obstructed", and the point is forgotten.
    • This works in the in-frame mode, on the server thread and for LAN guests.
  • Leaving the End now goes to the player's bed too, without using it up (the guest's own bed on the server, not the host's). This part has no test (see "What needs Ludovic").
  • Saves:
    • A bed is saved as the player's respawn and resolved through its block.
    • A /spawnpoint in the Overworld is now saved as forced, as vanilla does.
    • A fallback that is the world spawn now follows /setworldspawn even when a bed or anchor is set.

Fixes #1308

How tested

  • Parity harness: tools/test_use_item_on_parity.py gains respawn cases at a bed's head set from various yaws. The bed is intact, a bunk bed, only the foot left, or gone, with random blocks crowded around and on it, mostly in the Overworld. They run against vanilla's real ServerPlayer.findRespawnAndUseSpawnBlock. Results: 4000/4000 (default seed) and 12000/12000 (seed 7) cases match. A first run caught two differences, both fixed before these runs: straw beds can't set the spawn, and the yaw must be wrapped.
  • lan_e2e beds: the host and the guest each set a bed 12 blocks from the world spawn and die near the spawn. Three cases each: the bed intact, the bed removed, and the bed boxed in by stone.
Build In-frame mode Server thread
This branch PASS: intact → beside the bed; gone and boxed → the world spawn; health 20 PASS, same results
Chain top without this fix FAIL: intact → on the bed (y +0.56); gone → the removed bed's spot; boxed → on the roof (y 68) or inside the stone, suffocating (health 16) FAIL: gone → the removed bed's spot; boxed → inside the stone (health 17)
  • All of the chain's new checks on this branch, in both modes: absorption breath lava contacts shield deathmining worldspawn drops underwater beds minecarts levels, all PASS in the in-frame mode and on the server thread.
  • cargo clippy --workspace --all-targets -D warnings: clean. cargo test -p horizon-client: all pass.

What needs Ludovic

  • Old saves: a Horizon world saved with a /spawnpoint in the Overworld wrote it without the forced flag, so this build loads it as a bed. With no bed there, the first respawn goes to the world spawn with the "no home bed" message. Beds saved by Horizon load correctly.
  • Leaving the End: the change that sends the player to their bed has no test.

🤖 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/1416 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/23/2026 **Status:** ✅ Merged **Merged:** 10/23/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/bed-respawn` --- ### 📝 Commits (10+) - [`7acebba`](https://github.com/horizon-rust/horizon/commit/7acebbae45fb84ec7c905e05f4ac4e4220914d0b) Server players: the HUD's bubbles and golden hearts follow the server, absorption is saved, Nether lava pushes harder - [`ed28e1d`](https://github.com/horizon-rust/horizon/commit/ed28e1dd0d6f6959179ba5f1914cfb69de14d1ae) Contact damage: magma, cactus, lit campfires and sweet berry bushes hurt in both modes - [`2898b40`](https://github.com/horizon-rust/horizon/commit/2898b40670eb253a924560d5edfe8c3a4256a725) Server players: an axe-disabled shield stays down 5 s, death forgets the digging - [`5c4600e`](https://github.com/horizon-rust/horizon/commit/5c4600e4034ed5a5a0fc50c3d498dccbc8ab04cf) /setworldspawn moves the world spawn, not the player's respawn point - [`65bd2d0`](https://github.com/horizon-rust/horizon/commit/65bd2d0d45e15710af70cad00f642ae80f48b86e) Items push out of blocks; a server's client digs at the server's speed - [`feeefb3`](https://github.com/horizon-rust/horizon/commit/feeefb3a33db6cc33c0798f535d9bdc0e7aeb306) Mobs: a punch shows smooth and slow, as on vanilla's client - [`f949f08`](https://github.com/horizon-rust/horizon/commit/f949f08488fc42b3283c20f843c45f604cf09aa0) Merge remote-tracking branch 'origin/main' into fix/server-air-absorption - [`10f6b18`](https://github.com/horizon-rust/horizon/commit/10f6b183e3dcf0fec748c90211b7871c4342e918) Merge branch 'fix/server-air-absorption' into fix/contact-damage - [`48c1b04`](https://github.com/horizon-rust/horizon/commit/48c1b04cb05dc671dbd7b6657e5cf6c6f7f94b26) Merge branch 'fix/contact-damage' into fix/server-player-shield-mining - [`e84f86a`](https://github.com/horizon-rust/horizon/commit/e84f86a813eb3c24301178f3ee4aa69dcff17384) Merge branch 'fix/server-player-shield-mining' into fix/setworldspawn ### 📊 Changes **33 files changed** (+1961 additions, -139 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/attribute_updates.rs` (+5 -0) 📝 `crates/horizon-client/src/entities.rs` (+73 -5) 📝 `crates/horizon-client/src/game.rs` (+38 -19) 📝 `crates/horizon-client/src/game/agent.rs` (+5 -0) 📝 `crates/horizon-client/src/game/commands.rs` (+14 -1) 📝 `crates/horizon-client/src/game/dispense_fixture.rs` (+6 -6) 📝 `crates/horizon-client/src/game/dragon.rs` (+1 -0) 📝 `crates/horizon-client/src/game/end.rs` (+19 -2) 📝 `crates/horizon-client/src/game/lan.rs` (+10 -0) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+93 -2) 📝 `crates/horizon-client/src/game/lan_entities.rs` (+1 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+148 -46) 📝 `crates/horizon-client/src/game/respawn_anchor.rs` (+96 -3) 📝 `crates/horizon-client/src/game/server_travel.rs` (+21 -10) 📝 `crates/horizon-client/src/lan/entity.rs` (+37 -2) 📝 `crates/horizon-client/src/lan/guest.rs` (+9 -0) 📝 `crates/horizon-client/src/lan/hub.rs` (+25 -1) 📝 `crates/horizon-client/src/lan/playerdata.rs` (+13 -1) 📝 `crates/horizon-client/src/mobs.rs` (+7 -0) 📝 `crates/horizon-client/src/mobs/living.rs` (+3 -0) _...and 13 more files_ </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **Last in a chain:** #1407 → #1408 → #1409 → #1410 → #1411 → #1412 → this. Each branch merges the one before it, so this PR also shows their commits until they merge. This PR's own change: https://github.com/ludovic111/horizon/compare/fix/mob-knockback-view...fix/bed-respawn (one commit, 11 files, +335 −53). ## What **#1308** Removed or blocked beds are no longer valid respawn points, as in vanilla 26.3. - **Setting the point:** a bed sets the respawn point the way `ServerPlayer.startSleepInBed` does: once the player is in reach, day or night. The point is a `RespawnConfig` at the bed's head, with the player's yaw (wrapped as `RespawnData.of` does), not forced. Straw beds never set it (`straw_bed_rule`). Before, a bed stored a raw position, which respawning used without looking at the block. - **Respawning:** `findRespawnAndUseSpawnBlock` now handles beds: - It uses `AbstractBedBlock.findStandUpPosition` through `DismountHelper`. The player stands beside the bed on the side away from the yaw it was set from, then around it, then on it, with bunk beds handled too. The player faces the bed. - A bed that is gone or boxed in sends the player to the world spawn with "You have no home bed or charged respawn anchor, or it was obstructed", and the point is forgotten. - This works in the in-frame mode, on the server thread and for LAN guests. - **Leaving the End** now goes to the player's bed too, without using it up (the guest's own bed on the server, not the host's). This part has no test (see "What needs Ludovic"). - **Saves:** - A bed is saved as the player's `respawn` and resolved through its block. - A `/spawnpoint` in the Overworld is now saved as `forced`, as vanilla does. - A fallback that is the world spawn now follows `/setworldspawn` even when a bed or anchor is set. Fixes #1308 ## How tested - **Parity harness:** `tools/test_use_item_on_parity.py` gains respawn cases at a bed's head set from various yaws. The bed is intact, a bunk bed, only the foot left, or gone, with random blocks crowded around and on it, mostly in the Overworld. They run against vanilla's real `ServerPlayer.findRespawnAndUseSpawnBlock`. Results: **4000/4000** (default seed) and **12000/12000** (seed 7) cases match. A first run caught two differences, both fixed before these runs: straw beds can't set the spawn, and the yaw must be wrapped. - **lan_e2e `beds`:** the host and the guest each set a bed 12 blocks from the world spawn and die near the spawn. Three cases each: the bed intact, the bed removed, and the bed boxed in by stone. | Build | In-frame mode | Server thread | | --- | --- | --- | | This branch | PASS: intact → beside the bed; gone and boxed → the world spawn; health 20 | PASS, same results | | Chain top without this fix | FAIL: intact → on the bed (y +0.56); gone → the removed bed's spot; boxed → on the roof (y 68) or inside the stone, suffocating (health 16) | FAIL: gone → the removed bed's spot; boxed → inside the stone (health 17) | - **All of the chain's new checks on this branch**, in both modes: `absorption breath lava contacts shield deathmining worldspawn drops underwater beds minecarts levels`, all **PASS** in the in-frame mode and on the server thread. - `cargo clippy --workspace --all-targets -D warnings`: clean. `cargo test -p horizon-client`: all pass. ## What needs Ludovic - **Old saves:** a Horizon world saved with a `/spawnpoint` in the Overworld wrote it without the `forced` flag, so this build loads it as a bed. With no bed there, the first respawn goes to the world spawn with the "no home bed" message. Beds saved by Horizon load correctly. - **Leaving the End:** the change that sends the player to their bed has no test. 🤖 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 04:10:01 +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#3507
No description provided.