[PR #1843] [MERGED] Make hardcore players spectators when they respawn #3808

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

📋 Pull Request Information

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

Base: main ← Head: fix/1504-hardcore-spectator


📝 Commits (2)

  • 0481dbd Make hardcore players spectators when they respawn
  • 50727eb Harnesses: one scaffold for one-player dedicated server scripts

📊 Changes

6 files changed (+159 additions, -12 deletions)

View changed files

📝 crates/horizon-client/src/game/agent.rs (+6 -2)
📝 crates/horizon-client/src/game/lan_actions.rs (+5 -0)
📝 crates/horizon-client/src/game/screens.rs (+22 -5)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/LocatorBarClient.java (+5 -1)
➕ tools/test_hardcore_respawn_parity.py (+49 -0)
📝 tools/test_locator_bar_parity.py (+72 -4)

📄 Description

What and why

Fixes #1504.

In a hardcore world, dying and pressing the death screen's first button gave the player another survival life. In vanilla that button says "Spectate", the title says "Game Over!", and the server switches the respawned player to spectator.

  • Server side (server thread, LAN, dedicated): guest_respawn now sets the game mode to spectator after PlayerList.respawn when the world is hardcore, in the same order as vanilla. The mode is the guest's own, so it is saved with the player and stays spectator after reopening.
  • In-frame world (--no-server-thread): the death screen's respawn does the same for the local player.
  • The death screen uses deathScreen.spectate and deathScreen.title.hardcore in hardcore, as DeathScreen.init and its constructor do. horizon-ctl's respawn action looks for the right label.

Vanilla reference

  • ServerGamePacketListenerImpl.handleClientCommand (PERFORM_RESPAWN: respawn, then setGameMode(SPECTATOR) when server.isHardcore())
  • ServerPlayer.setGameMode
  • DeathScreen.<init> and DeathScreen.init (hardcore title and button label)

New harness tools/test_hardcore_respawn_parity.py: a vanilla dedicated server and Horizon's each serve the same hardcore flat world. A LocatorBarClient player runs /kill @s and sends PERFORM_RESPAWN (a new respawn NAME command in LocatorBarClient). The respawn and game mode packets of the death and respawn steps are compared exactly. With the fix both sides send respawn minecraft:overworld then gamemode 3. I did not run it against the unfixed build; without the fix Horizon sends no game mode change at all, so the comparison fails.

Ran: python3 tools/parity.py hardcore_respawn dedicated_server locator_bar (the new harness, the non-hardcore dedicated respawn, and another LocatorBarClient user). parity.py --changed origin/main selects 338 of 340 harnesses for a horizon-client change, so I ran those named ones instead. cargo check -p horizon-client is clean.

Self-check

pr_ready (tools/pr_ready.py --quick on device-591, against origin/main at bd591f985, 4 min 9 s)

Check Result
Scope ✅ 5 files, +177 −8
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 267 passed (28 s)
rustfmt ✅ (6 s)
clippy ✅ (4 s)
tests: horizon-client ✅ 1236 passed (3 min 27 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 320 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, bamboo, basic_feature and 308 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🔄 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/1843 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/1504-hardcore-spectator` --- ### 📝 Commits (2) - [`0481dbd`](https://github.com/horizon-rust/horizon/commit/0481dbdb81e49134f42dccafb58474504466a440) Make hardcore players spectators when they respawn - [`50727eb`](https://github.com/horizon-rust/horizon/commit/50727eb5c3d389628549c9237bbcca76029c3b79) Harnesses: one scaffold for one-player dedicated server scripts ### 📊 Changes **6 files changed** (+159 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/agent.rs` (+6 -2) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+5 -0) 📝 `crates/horizon-client/src/game/screens.rs` (+22 -5) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/LocatorBarClient.java` (+5 -1) ➕ `tools/test_hardcore_respawn_parity.py` (+49 -0) 📝 `tools/test_locator_bar_parity.py` (+72 -4) </details> ### 📄 Description ## What and why Fixes #1504. In a hardcore world, dying and pressing the death screen's first button gave the player another survival life. In vanilla that button says "Spectate", the title says "Game Over!", and the server switches the respawned player to spectator. - Server side (server thread, LAN, dedicated): `guest_respawn` now sets the game mode to spectator after `PlayerList.respawn` when the world is hardcore, in the same order as vanilla. The mode is the guest's own, so it is saved with the player and stays spectator after reopening. - In-frame world (`--no-server-thread`): the death screen's respawn does the same for the local player. - The death screen uses `deathScreen.spectate` and `deathScreen.title.hardcore` in hardcore, as `DeathScreen.init` and its constructor do. `horizon-ctl`'s respawn action looks for the right label. ## Vanilla reference - `ServerGamePacketListenerImpl.handleClientCommand` (PERFORM_RESPAWN: `respawn`, then `setGameMode(SPECTATOR)` when `server.isHardcore()`) - `ServerPlayer.setGameMode` - `DeathScreen.<init>` and `DeathScreen.init` (hardcore title and button label) New harness `tools/test_hardcore_respawn_parity.py`: a vanilla dedicated server and Horizon's each serve the same hardcore flat world. A LocatorBarClient player runs `/kill @s` and sends PERFORM_RESPAWN (a new `respawn NAME` command in LocatorBarClient). The respawn and game mode packets of the death and respawn steps are compared exactly. With the fix both sides send `respawn minecraft:overworld` then `gamemode 3`. I did not run it against the unfixed build; without the fix Horizon sends no game mode change at all, so the comparison fails. Ran: `python3 tools/parity.py hardcore_respawn dedicated_server locator_bar` (the new harness, the non-hardcore dedicated respawn, and another LocatorBarClient user). `parity.py --changed origin/main` selects 338 of 340 harnesses for a horizon-client change, so I ran those named ones instead. `cargo check -p horizon-client` is clean. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on device-591, against origin/main at bd591f985, 4 min 9 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +177 −8 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 267 passed (28 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (4 s) | | tests: horizon-client | ✅ 1236 passed (3 min 27 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 320 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, bamboo, basic_feature and 308 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:12:27 +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#3808
No description provided.