[PR #2679] [MERGED] Add the spectator menu with Teleport to Player and Teleport to Team Member #4534

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

📋 Pull Request Information

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

Base: main ← Head: feat/spectator-menu


📝 Commits (3)

  • 9142f57 Add the spectator menu with Teleport to Player and Teleport to Team Member
  • 9d93893 Merge main into feat/spectator-menu
  • b8ae723 Merge main into feat/spectator-menu

📊 Changes

7 files changed (+625 additions, -9 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+27 -6)
📝 crates/horizon-client/src/game/lan_actions.rs (+51 -1)
➕ crates/horizon-client/src/game/spectator.rs (+112 -0)
📝 crates/horizon-client/src/lib.rs (+1 -0)
➕ crates/horizon-client/src/spectator_menu.rs (+419 -0)
📝 crates/horizon-client/src/tab_list.rs (+13 -2)
📝 crates/horizon-protocol/src/packets/play.rs (+2 -0)

📄 Description

What and why

Spectators had no menu: the number keys only moved the hidden hotbar selection and the middle button did nothing. This adds the vanilla spectator menu.

  • Press a number key or the spectator key (middle button) to open it. The hotbar shows Teleport to Player and Teleport to Team Member, then the scroll arrows and Close Menu. A first press selects a slot, a second press uses it. The mouse wheel moves between usable slots. The menu fades after 5 seconds and the item name or prompt shows over it.
  • The Teleport to Player page lists the listed players that are not spectators, ordered like vanilla, with their faces. The team page lists teams that have a player to go to, with the team colour and a face. Pages scroll six items at a time.
  • Choosing a player sends the teleport request. The server (single player's own, LAN and dedicated) moves the spectator to that player, into their level on a dedicated server.
  • With no menu open, the mouse wheel still changes the fly speed.

New code is the menu model in spectator_menu.rs, its glue in game/spectator.rs, the TeleportToEntity packet and its handler in lan_actions.rs. tab_list::face is now public and takes a colour so the faces can fade.

Vanilla reference

  • SpectatorGui (onHotbarSelected, onHotbarActionKeyPressed, onMouseScrolled, extractHotbar, extractAction).
  • SpectatorMenu, RootSpectatorMenuCategory, TeleportToPlayerMenuCategory, TeleportToTeamMenuCategory, PlayerMenuItem.
  • Minecraft.handleKeybinds (number keys and keySpectatorHotbar) and MouseHandler.onScroll.
  • ServerboundTeleportToEntityPacket and ServerGamePacketListenerImpl.handleTeleportToEntityPacket.

Self-check

cargo check -p horizon-client passes.


🔄 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/2679 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/spectator-menu` --- ### 📝 Commits (3) - [`9142f57`](https://github.com/horizon-rust/horizon/commit/9142f57bc8567b29594c3c48a9d9effae845e771) Add the spectator menu with Teleport to Player and Teleport to Team Member - [`9d93893`](https://github.com/horizon-rust/horizon/commit/9d9389310d641fb09ead0987fb7514d889a65f56) Merge main into feat/spectator-menu - [`b8ae723`](https://github.com/horizon-rust/horizon/commit/b8ae7233e0ff9e0fd66e079117999b5f42c01c35) Merge main into feat/spectator-menu ### 📊 Changes **7 files changed** (+625 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+27 -6) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+51 -1) ➕ `crates/horizon-client/src/game/spectator.rs` (+112 -0) 📝 `crates/horizon-client/src/lib.rs` (+1 -0) ➕ `crates/horizon-client/src/spectator_menu.rs` (+419 -0) 📝 `crates/horizon-client/src/tab_list.rs` (+13 -2) 📝 `crates/horizon-protocol/src/packets/play.rs` (+2 -0) </details> ### 📄 Description ## What and why Spectators had no menu: the number keys only moved the hidden hotbar selection and the middle button did nothing. This adds the vanilla spectator menu. - Press a number key or the spectator key (middle button) to open it. The hotbar shows Teleport to Player and Teleport to Team Member, then the scroll arrows and Close Menu. A first press selects a slot, a second press uses it. The mouse wheel moves between usable slots. The menu fades after 5 seconds and the item name or prompt shows over it. - The Teleport to Player page lists the listed players that are not spectators, ordered like vanilla, with their faces. The team page lists teams that have a player to go to, with the team colour and a face. Pages scroll six items at a time. - Choosing a player sends the teleport request. The server (single player's own, LAN and dedicated) moves the spectator to that player, into their level on a dedicated server. - With no menu open, the mouse wheel still changes the fly speed. New code is the menu model in `spectator_menu.rs`, its glue in `game/spectator.rs`, the `TeleportToEntity` packet and its handler in `lan_actions.rs`. `tab_list::face` is now public and takes a colour so the faces can fade. ## Vanilla reference - `SpectatorGui` (`onHotbarSelected`, `onHotbarActionKeyPressed`, `onMouseScrolled`, `extractHotbar`, `extractAction`). - `SpectatorMenu`, `RootSpectatorMenuCategory`, `TeleportToPlayerMenuCategory`, `TeleportToTeamMenuCategory`, `PlayerMenuItem`. - `Minecraft.handleKeybinds` (number keys and `keySpectatorHotbar`) and `MouseHandler.onScroll`. - `ServerboundTeleportToEntityPacket` and `ServerGamePacketListenerImpl.handleTeleportToEntityPacket`. ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:17: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#4534
No description provided.