[PR #4877] [MERGED] Ignore a player's moves and actions until their client has loaded #5910

Closed
opened 2026-11-03 05:15:52 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/client-loaded-gate


📝 Commits (2)

  • 704dff7 Ignore a player's moves and actions until their client has loaded
  • c644282 lan_bot: the hub tests' guests have loaded their level

📊 Changes

7 files changed (+177 additions, -7 deletions)

View changed files

📝 crates/horizon-bots/src/main.rs (+11 -1)
📝 crates/horizon-client/src/game/lan_actions.rs (+2 -0)
📝 crates/horizon-client/src/game/lan_vehicles.rs (+1 -1)
📝 crates/horizon-client/src/lan/guest.rs (+25 -0)
📝 crates/horizon-client/src/lan/hub.rs (+27 -5)
📝 crates/horizon-client/tests/lan_bot.rs (+3 -0)
➕ tools/server_client_loaded_e2e.py (+108 -0)

📄 Description

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

Phase 5 of the anticheat work (vanilla's own packet checks, always on as parity): ServerGamePacketListenerImpl.hasClientLoaded.

Vanilla ignores a player's actions until their client says the level around it is loaded (ServerboundPlayerLoadedPacket) or 60 ticks pass (clientLoadedTimeoutTimer, ticked in ServerPlayer.tick). The wait starts again after a respawn (restartClientLoadTimerAfterRespawn), and nothing counts while the player is dead (waitingForRespawn). Ten handlers check it:

  • moves: handleMovePlayer and handleMoveVehicle;
  • block actions and item use: handlePlayerAction, handleUseItemOn and handleUseItem;
  • entities: handleAttack and handleInteract;
  • handleSpectatorAction and handlePlayerCommand;
  • handlePlayerInput, which still records the keys but doesn't change crouching.

Before this, the server only skipped a rotation-only move before the first position, and loaded never went back to false after a respawn. So a client could move, dig, place, attack and use items while its level was still loading.

  • Guest::client_loaded() and load_timeout (60 at join and on respawn, 0 when PlayerLoaded comes, counted down at the start of each tick's packets).
  • The hub drops those packets before they reach the game, in the order they came, so a PlayerLoaded queued behind them doesn't let them through.
  • MoveVehicle keeps its invalid-values disconnect first, as in vanilla.

Not in this PR: ServerPlayer.isInvulnerableTo also makes a player who hasn't loaded invulnerable. Damage to guests runs through several paths, so that's a separate change.

Test

horizon-bots --no-loaded never sends PlayerLoaded. tools/server_client_loaded_e2e.py, on a dedicated server:

not loaded: still at y -60.0 after 1.5 s, moved to y -36.0 after 6 s (the 60-tick timeout)
loaded: moved from y -60.0 to -45.5 within 1.5 s

On main it fails: a client that has not loaded moved from y -60.0 to -45.0 within 1.5 s.

  • python3 tools/parity.py dedicated_server server_entities server_player_damage hardcore_respawn lan_integration forced_end cursor_death: 7 passed.
  • python3 tools/lan_e2e.py --check respawn --check spawned --check portals --check digging --check deathmining: all pass.
  • The three lan_bot tests that drive a hub guest by hand now mark it loaded, as a client would.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 2fb0d5b49, 4 min 27 s)

Check Result
Scope ✅ 7 files, +177 −7
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 481 passed (41 s)
rustfmt ✅ (5 s)
clippy ✅ (36 s)
tests: horizon-bots, horizon-client ✅ 1252 passed (2 min 41 s)
doc tests ✅ 0 passed
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 33 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, locator_bar and 21 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/4877 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/client-loaded-gate` --- ### 📝 Commits (2) - [`704dff7`](https://github.com/horizon-rust/horizon/commit/704dff73bd62e2543c1a195fe830cd4c6ef4acbf) Ignore a player's moves and actions until their client has loaded - [`c644282`](https://github.com/horizon-rust/horizon/commit/c644282b7b1f39dfe5ded7244707b54b4a6cdeca) lan_bot: the hub tests' guests have loaded their level ### 📊 Changes **7 files changed** (+177 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-bots/src/main.rs` (+11 -1) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+2 -0) 📝 `crates/horizon-client/src/game/lan_vehicles.rs` (+1 -1) 📝 `crates/horizon-client/src/lan/guest.rs` (+25 -0) 📝 `crates/horizon-client/src/lan/hub.rs` (+27 -5) 📝 `crates/horizon-client/tests/lan_bot.rs` (+3 -0) ➕ `tools/server_client_loaded_e2e.py` (+108 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Phase 5 of the anticheat work (vanilla's own packet checks, always on as parity): `ServerGamePacketListenerImpl.hasClientLoaded`. Vanilla ignores a player's actions until their client says the level around it is loaded (`ServerboundPlayerLoadedPacket`) or 60 ticks pass (`clientLoadedTimeoutTimer`, ticked in `ServerPlayer.tick`). The wait starts again after a respawn (`restartClientLoadTimerAfterRespawn`), and nothing counts while the player is dead (`waitingForRespawn`). Ten handlers check it: - moves: `handleMovePlayer` and `handleMoveVehicle`; - block actions and item use: `handlePlayerAction`, `handleUseItemOn` and `handleUseItem`; - entities: `handleAttack` and `handleInteract`; - `handleSpectatorAction` and `handlePlayerCommand`; - `handlePlayerInput`, which still records the keys but doesn't change crouching. Before this, the server only skipped a rotation-only move before the first position, and `loaded` never went back to false after a respawn. So a client could move, dig, place, attack and use items while its level was still loading. - `Guest::client_loaded()` and `load_timeout` (60 at join and on respawn, 0 when PlayerLoaded comes, counted down at the start of each tick's packets). - The hub drops those packets before they reach the game, in the order they came, so a PlayerLoaded queued behind them doesn't let them through. - `MoveVehicle` keeps its invalid-values disconnect first, as in vanilla. Not in this PR: `ServerPlayer.isInvulnerableTo` also makes a player who hasn't loaded invulnerable. Damage to guests runs through several paths, so that's a separate change. ### Test `horizon-bots --no-loaded` never sends PlayerLoaded. `tools/server_client_loaded_e2e.py`, on a dedicated server: ``` not loaded: still at y -60.0 after 1.5 s, moved to y -36.0 after 6 s (the 60-tick timeout) loaded: moved from y -60.0 to -45.5 within 1.5 s ``` On main it fails: `a client that has not loaded moved from y -60.0 to -45.0 within 1.5 s`. - `python3 tools/parity.py dedicated_server server_entities server_player_damage hardcore_respawn lan_integration forced_end cursor_death`: 7 passed. - `python3 tools/lan_e2e.py --check respawn --check spawned --check portals --check digging --check deathmining`: all pass. - The three `lan_bot` tests that drive a hub guest by hand now mark it loaded, as a client would. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 2fb0d5b49, 4 min 27 s) | Check | Result | | --- | --- | | Scope | ✅ 7 files, +177 −7 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 481 passed (41 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (36 s) | | tests: horizon-bots, horizon-client | ✅ 1252 passed (2 min 41 s) | | doc tests | ✅ 0 passed | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 33 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, locator_bar and 21 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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 05:15:52 +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#5910
No description provided.