[PR #5082] [MERGED] Land a spectator who becomes creative while standing on the floor #6049

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

📋 Pull Request Information

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

Base: main ← Head: fix/gamemode-ground-flight


📝 Commits (1)

  • 2d519f8 Land a spectator who becomes creative while standing on the floor

📊 Changes

7 files changed (+168 additions, -13 deletions)

View changed files

📝 crates/horizon-client/src/game/game_mode.rs (+26 -2)
📝 crates/horizon-client/src/game/integrated.rs (+2 -1)
📝 crates/horizon-client/src/game/lan.rs (+10 -4)
📝 crates/horizon-client/src/game/lan_actions.rs (+4 -2)
📝 crates/horizon-client/src/lan/hub.rs (+23 -1)
📝 crates/horizon-client/tests/lan_bot.rs (+1 -1)
📝 crates/horizon-world/src/world_movement.rs (+102 -2)

📄 Description

Fixes the ServerPlayerGameMode.isInRangeOfGround row (and its Entity.getAvailableSpaceBelow half) in the port ledger. (No issue.)

Vanilla's changeGameModeForPlayer does two things beyond the mode's abilities: setGameModeForPlayer (which is GameType.updatePlayerAbilities), and then, when the player is still flying, the new mode is not spectator and isInRangeOfGround() — clear flight. isInRangeOfGround is collectAllColliders(...).isEmpty() && getAvailableSpaceBelow(1.0) < 1.0: no collider touches the body, and the block under the feet is within one block. So /gamemode spectator then /gamemode creative while standing on the floor lands you. Horizon mirrors updatePlayerAbilities faithfully in both funnels and never applied the ground step, so the player kept hovering.

The probe lives in horizon-world's movement module beside the noCollision port, split so the collider decision can be tested without chunks or a registry, and both funnels — the local player's set_mode and a guest's set_game_mode, whose signature gains the world and collision binding — call it. The flight clear now also only runs on an actual mode change, matching vanilla's early return.

Proven: three unit tests pass on a build box (feet on a floor and hovering half a block up are in range; high in the air and no colliders are not; a body intersecting a block is not), and cargo check -p horizon-client --lib --bins is clean with the signature change.

Not proven: nothing in a game. The honest check is standing on the floor, /gamemode spectator, /gamemode creative and landing — plus the mid-air case keeping flight. CONTRIBUTING asks for a harness on gameplay changes and this has none: ServerPlayerGameMode.changeGameModeForPlayer would need a Vanilla*Oracle entry and a probe, which I could not build or run here.

Two limits, both marked in the code rather than hidden: entity colliders are not consulted, so a player standing on a boat keeps flying where vanilla would land them (SceneCollisions never supplies entity collisions), and the LAN screen's own mode change uses the level currently loaded in the world, which for an owner in a dimension that was not ticked last could be the wrong level's blocks.


🔄 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/5082 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/gamemode-ground-flight` --- ### 📝 Commits (1) - [`2d519f8`](https://github.com/horizon-rust/horizon/commit/2d519f8808bbf3555ee6caca7da19f1ebe0c53c0) Land a spectator who becomes creative while standing on the floor ### 📊 Changes **7 files changed** (+168 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/game_mode.rs` (+26 -2) 📝 `crates/horizon-client/src/game/integrated.rs` (+2 -1) 📝 `crates/horizon-client/src/game/lan.rs` (+10 -4) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+4 -2) 📝 `crates/horizon-client/src/lan/hub.rs` (+23 -1) 📝 `crates/horizon-client/tests/lan_bot.rs` (+1 -1) 📝 `crates/horizon-world/src/world_movement.rs` (+102 -2) </details> ### 📄 Description Fixes the `ServerPlayerGameMode.isInRangeOfGround` row (and its `Entity.getAvailableSpaceBelow` half) in the port ledger. (No issue.) Vanilla's `changeGameModeForPlayer` does two things beyond the mode's abilities: `setGameModeForPlayer` (which is `GameType.updatePlayerAbilities`), and then, when the player is still flying, the new mode is not spectator and `isInRangeOfGround()` — clear flight. `isInRangeOfGround` is `collectAllColliders(...).isEmpty() && getAvailableSpaceBelow(1.0) < 1.0`: no collider touches the body, and the block under the feet is within one block. So `/gamemode spectator` then `/gamemode creative` while standing on the floor **lands** you. Horizon mirrors `updatePlayerAbilities` faithfully in both funnels and never applied the ground step, so the player kept hovering. The probe lives in `horizon-world`'s movement module beside the `noCollision` port, split so the collider decision can be tested without chunks or a registry, and both funnels — the local player's `set_mode` and a guest's `set_game_mode`, whose signature gains the world and collision binding — call it. The flight clear now also only runs on an actual mode change, matching vanilla's early return. **Proven:** three unit tests pass on a build box (feet on a floor and hovering half a block up are in range; high in the air and no colliders are not; a body intersecting a block is not), and `cargo check -p horizon-client --lib --bins` is clean with the signature change. **Not proven:** nothing in a game. The honest check is standing on the floor, `/gamemode spectator`, `/gamemode creative` and landing — plus the mid-air case keeping flight. `CONTRIBUTING` asks for a harness on gameplay changes and this has none: `ServerPlayerGameMode.changeGameModeForPlayer` would need a `Vanilla*Oracle` entry and a probe, which I could not build or run here. Two limits, both marked in the code rather than hidden: **entity colliders are not consulted**, so a player standing on a boat keeps flying where vanilla would land them (`SceneCollisions` never supplies entity collisions), and the LAN screen's own mode change uses the level currently loaded in the world, which for an owner in a dimension that was not ticked last could be the wrong level's blocks. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:51 +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#6049
No description provided.