[PR #472] [MERGED] LAN guest: command feedback names the guest and shows its numbers #2589

Closed
opened 2026-11-02 15:57:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/lan-guest-chat


📝 Commits (10+)

  • dac18e8 LAN: mobs target and attack guests
  • 327aa5a tools/lan_e2e.py: a world with commands, so the guest's commands run again
  • 600bae5 LAN guest: hurt by lava, fire, drowning, suffocation and the void; hungry from moving
  • 2e12123 tools/lan_e2e.py: hazards counts the food spent from full health
  • 36d7f02 LAN: PvP between the host and guests
  • e289980 LAN guest: their own ender chest, and double chests as 9x6
  • 64f7ecd tools/lan_e2e.py: containers takes its chests away
  • 257b5e9 tools/lan_e2e.py: containers waits for the server's menu before reading or taking
  • bc0cd9c LAN guest: a use packet uses the item alone
  • 11130e6 LAN guest: command feedback names the guest and shows its numbers

📊 Changes

20 files changed (+1126 additions, -125 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+71 -43)
📝 crates/horizon-client/src/game/agent.rs (+1 -1)
📝 crates/horizon-client/src/game/commands.rs (+9 -5)
📝 crates/horizon-client/src/game/control.rs (+12 -0)
📝 crates/horizon-client/src/game/creatures.rs (+74 -9)
📝 crates/horizon-client/src/game/hand.rs (+1 -0)
📝 crates/horizon-client/src/game/lan.rs (+10 -0)
📝 crates/horizon-client/src/game/lan_actions.rs (+134 -28)
➕ crates/horizon-client/src/game/lan_mobs.rs (+264 -0)
➕ crates/horizon-client/src/game/lan_pvp.rs (+110 -0)
📝 crates/horizon-client/src/game/remote.rs (+47 -1)
📝 crates/horizon-client/src/game/storage.rs (+7 -1)
📝 crates/horizon-client/src/lan/containers.rs (+26 -27)
📝 crates/horizon-client/src/lan/guest.rs (+6 -0)
📝 crates/horizon-client/src/lan/hub.rs (+3 -0)
📝 crates/horizon-client/src/lan/menu.rs (+72 -1)
📝 crates/horizon-client/src/lan/playerdata.rs (+6 -1)
📝 crates/horizon-client/src/motion/environment.rs (+21 -1)
📝 crates/horizon-protocol/src/text.rs (+32 -3)
📝 tools/lan_e2e.py (+220 -4)

📄 Description

Part of #435 (items: command feedback calls the guest "Player"; chat shows "Replaced slot(s)" with the number missing). Stacked on #471: merge #466, #467, #470, #471, then this.

What vanilla does

  • Command feedback about a player uses Entity.getDisplayName, i.e. the player who ran it, under their team's formatting.
  • Translation arguments may be numbers. In NBT a list mixing types wraps each bare value as {"": value} (NbtOps), and the client's ComponentSerialization reads it back whatever the type.

What this changes

  • target_name(Target::Player) names the guest a command runs for (Game.lan_acting_name, set by as_guest).
  • horizon_protocol::text::plain unwraps {"": value} for any value; it only handled strings, so numbers (slot counts, coordinates) vanished. This was a client-side bug, so it fixes Horizon as a client of any server, vanilla included.
  • horizon-ctl messages reads a server's chat when connected to one (it listed only local chat).

Left as it was: the host itself is still called "Player" in its own feedback (chat::PLAYER_NAME), outside this issue.

How it was verified

  • Two real clients on this Mac (host + guest, offscreen): new feedback check in tools/lan_e2e.py. The guest's chat after its own commands: Replaced 1 slot(s) on Guest with [Stick], Teleported Guest to -1.500000, 65.000000, 5.500000. Before: Replaced slot(s) on Player with [Stick], and the coordinates were empty in item replace block feedback.
  • Unit test horizon_protocol::text::tests::unwraps_mixed_list_arguments.
  • fmt, cargo clippy -p horizon-client -p horizon-protocol --all-targets -- -D warnings, cargo test -p horizon-protocol. Parity harnesses: one tools/parity.py --changed origin/main run on the branch combining this series (results on the last PR).

Follow-up (after a full 14-check run on the combined stack)

  • Control socket: the key command now reaches a server's chat input, as remote_chat_key does for the real keyboard. Before, Escape paused the guest instead of closing its chat.
  • feedback check:
    • It expects the rounded teleport position.
    • It checks that the chat really closed.

🤖 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/472 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/lan-guest-chat` --- ### 📝 Commits (10+) - [`dac18e8`](https://github.com/horizon-rust/horizon/commit/dac18e8350600d38c4c6b95d987d4738b802185f) LAN: mobs target and attack guests - [`327aa5a`](https://github.com/horizon-rust/horizon/commit/327aa5af6e710b1aa0e3e10652ce0453943b6710) tools/lan_e2e.py: a world with commands, so the guest's commands run again - [`600bae5`](https://github.com/horizon-rust/horizon/commit/600bae5703d222c7b1bd3c51ee8e72b3be12557e) LAN guest: hurt by lava, fire, drowning, suffocation and the void; hungry from moving - [`2e12123`](https://github.com/horizon-rust/horizon/commit/2e1212346f411c06657dec6a68b35ea853430502) tools/lan_e2e.py: hazards counts the food spent from full health - [`36d7f02`](https://github.com/horizon-rust/horizon/commit/36d7f02802889397f0d3c1d71fffbd15a2025f54) LAN: PvP between the host and guests - [`e289980`](https://github.com/horizon-rust/horizon/commit/e289980c1ea486228c73d1b007f522c387cf4c28) LAN guest: their own ender chest, and double chests as 9x6 - [`64f7ecd`](https://github.com/horizon-rust/horizon/commit/64f7ecd3671cfa13a044f68c048885c02a34f021) tools/lan_e2e.py: containers takes its chests away - [`257b5e9`](https://github.com/horizon-rust/horizon/commit/257b5e9f2d76c3d39e84a13754b2363d846cb8e9) tools/lan_e2e.py: containers waits for the server's menu before reading or taking - [`bc0cd9c`](https://github.com/horizon-rust/horizon/commit/bc0cd9cc844853472e83c780e07ec3db2cbde7ad) LAN guest: a use packet uses the item alone - [`11130e6`](https://github.com/horizon-rust/horizon/commit/11130e6ef7bf8d75ed006d3b7c63a81a9110422a) LAN guest: command feedback names the guest and shows its numbers ### 📊 Changes **20 files changed** (+1126 additions, -125 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+71 -43) 📝 `crates/horizon-client/src/game/agent.rs` (+1 -1) 📝 `crates/horizon-client/src/game/commands.rs` (+9 -5) 📝 `crates/horizon-client/src/game/control.rs` (+12 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+74 -9) 📝 `crates/horizon-client/src/game/hand.rs` (+1 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+10 -0) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+134 -28) ➕ `crates/horizon-client/src/game/lan_mobs.rs` (+264 -0) ➕ `crates/horizon-client/src/game/lan_pvp.rs` (+110 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+47 -1) 📝 `crates/horizon-client/src/game/storage.rs` (+7 -1) 📝 `crates/horizon-client/src/lan/containers.rs` (+26 -27) 📝 `crates/horizon-client/src/lan/guest.rs` (+6 -0) 📝 `crates/horizon-client/src/lan/hub.rs` (+3 -0) 📝 `crates/horizon-client/src/lan/menu.rs` (+72 -1) 📝 `crates/horizon-client/src/lan/playerdata.rs` (+6 -1) 📝 `crates/horizon-client/src/motion/environment.rs` (+21 -1) 📝 `crates/horizon-protocol/src/text.rs` (+32 -3) 📝 `tools/lan_e2e.py` (+220 -4) </details> ### 📄 Description Part of #435 (items: command feedback calls the guest "Player"; chat shows "Replaced slot(s)" with the number missing). Stacked on #471: merge #466, #467, #470, #471, then this. ## What vanilla does - Command feedback about a player uses `Entity.getDisplayName`, i.e. the player who ran it, under their team's formatting. - Translation arguments may be numbers. In NBT a list mixing types wraps each bare value as `{"": value}` (NbtOps), and the client's `ComponentSerialization` reads it back whatever the type. ## What this changes - `target_name(Target::Player)` names the guest a command runs for (`Game.lan_acting_name`, set by `as_guest`). - `horizon_protocol::text::plain` unwraps `{"": value}` for any value; it only handled strings, so numbers (slot counts, coordinates) vanished. This was a client-side bug, so it fixes Horizon as a client of any server, vanilla included. - `horizon-ctl messages` reads a server's chat when connected to one (it listed only local chat). Left as it was: the host itself is still called "Player" in its own feedback (`chat::PLAYER_NAME`), outside this issue. ## How it was verified - **Two real clients on this Mac** (host + guest, offscreen): new `feedback` check in `tools/lan_e2e.py`. The guest's chat after its own commands: `Replaced 1 slot(s) on Guest with [Stick]`, `Teleported Guest to -1.500000, 65.000000, 5.500000`. Before: `Replaced slot(s) on Player with [Stick]`, and the coordinates were empty in `item replace block` feedback. - Unit test `horizon_protocol::text::tests::unwraps_mixed_list_arguments`. - fmt, `cargo clippy -p horizon-client -p horizon-protocol --all-targets -- -D warnings`, `cargo test -p horizon-protocol`. Parity harnesses: one `tools/parity.py --changed origin/main` run on the branch combining this series (results on the last PR). ## Follow-up (after a full 14-check run on the combined stack) - **Control socket:** the `key` command now reaches a server's chat input, as `remote_chat_key` does for the real keyboard. Before, Escape paused the guest instead of closing its chat. - **`feedback` check:** - It expects the rounded teleport position. - It checks that the chat really closed. 🤖 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-02 15:57:25 +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#2589
No description provided.