[PR #427] [MERGED] LAN: chest and shulker box lids open and close for every player #2558

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

📋 Pull Request Information

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

Base: main ← Head: fix/lan-chest-lids


📝 Commits (2)

  • 4718fef LAN: chest lids open and close for every player
  • 8d6b8b3 LAN: a trading screen a guest opens releases the chest it replaces

📊 Changes

7 files changed (+101 additions, -19 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+4 -0)
📝 crates/horizon-client/src/game/agent.rs (+10 -3)
📝 crates/horizon-client/src/game/block_entity_anims.rs (+29 -9)
📝 crates/horizon-client/src/game/lan.rs (+6 -0)
📝 crates/horizon-client/src/game/lan_actions.rs (+33 -7)
📝 crates/horizon-client/src/game/lan_trading.rs (+2 -0)
📝 crates/horizon-client/src/game/remote.rs (+17 -0)

📄 Description

What

Chest, ender chest and shulker box lids open and close for every player on LAN. When a guest opens a chest, its lid opens on the guest's screen and on the host's, and it closes on both when the guest closes it. A guest's trading screen releases the chest it replaces.

Why

Vanilla counts every player looking into a container (ContainerOpenersCounter, ShulkerBoxBlockEntity.startOpen/stopOpen) and sends the count to every client as block event 1 (ChestBlockEntity.signalOpenCount). Clients apply it in ClientLevel.blockEvent → triggerEvent and animate the lid in tickBlockEntities. Horizon tied the lid to the host's own player only. The host never sent the event to guests. The guest client ignored BlockEvent and never ticked block entity animations. So the guest's chest never animated on either side.

How

  • container_openers_changed(pos, open) keeps lid_openers per position (both halves of a double chest), triggers the event locally and sends it to guests (lan_block_event).
  • On the host, a guest's open, close, leave, replaced container (crafting table, trading) or failed open each count once (guest_container_closed). Spectators don't count, as in vanilla.
  • Guest: tick_remote ticks block entity animations. BlockEvent is applied when the block is still the one it names.
  • Server-only effects stay off on a guest: bell resonance, raider glow and the end gateway's server tick.
  • The agent's block query reports lid (chest lid or shulker progress) for the test.

How tested

Two-client test (tools/lan_e2e.py, its own PR, #424): a host and a guest, both real games offscreen on the Mac mini, the guest joining over 127.0.0.1. Each check is reported on its own, with screenshots of both sides.

check origin/main this branch alone all six fixes merged
chest FAIL (lid 0.0 / 0.0 while the guest has it open) PASS (open 1.0 / 1.0, closed 0 / 0) PASS

Screenshots, before and after, both sides: ~/code/horizon-parity/shots/lan/ (before-*, *-after-*, after-all-*).

Self-check on the integration commit (origin/main + the six LAN fixes):

cargo fmt --all --check                                       clean
cargo clippy --workspace --all-targets -- -D warnings         clean (exit 0)
cargo test -p horizon-client                                  743 passed, 0 failed
tools/parity.py --changed origin/main                         81 harnesses depend on the change: 81 passed, 0 failed

What needs Ludovic

  • Nothing to decide. Not tested: two physical machines (every run was host and guest on one Mac over loopback).

Fixes #366 (one of six PRs; merge order: self-model, armour, chest lids, name tags, crafting, damage, then the test).

🤖 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/427 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/lan-chest-lids` --- ### 📝 Commits (2) - [`4718fef`](https://github.com/horizon-rust/horizon/commit/4718fef2ab7b5607fa471731f0264bba83c6c991) LAN: chest lids open and close for every player - [`8d6b8b3`](https://github.com/horizon-rust/horizon/commit/8d6b8b3f03d3b5f828da3e7df5402de8d2466fd2) LAN: a trading screen a guest opens releases the chest it replaces ### 📊 Changes **7 files changed** (+101 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+4 -0) 📝 `crates/horizon-client/src/game/agent.rs` (+10 -3) 📝 `crates/horizon-client/src/game/block_entity_anims.rs` (+29 -9) 📝 `crates/horizon-client/src/game/lan.rs` (+6 -0) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+33 -7) 📝 `crates/horizon-client/src/game/lan_trading.rs` (+2 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+17 -0) </details> ### 📄 Description ## What Chest, ender chest and shulker box lids open and close for every player on LAN. When a guest opens a chest, its lid opens on the guest's screen and on the host's, and it closes on both when the guest closes it. A guest's trading screen releases the chest it replaces. ## Why Vanilla counts every player looking into a container (`ContainerOpenersCounter`, `ShulkerBoxBlockEntity.startOpen/stopOpen`) and sends the count to every client as block event 1 (`ChestBlockEntity.signalOpenCount`). Clients apply it in `ClientLevel.blockEvent` → `triggerEvent` and animate the lid in `tickBlockEntities`. Horizon tied the lid to the host's own player only. The host never sent the event to guests. The guest client ignored `BlockEvent` and never ticked block entity animations. So the guest's chest never animated on either side. ## How - `container_openers_changed(pos, open)` keeps `lid_openers` per position (both halves of a double chest), triggers the event locally and sends it to guests (`lan_block_event`). - On the host, a guest's open, close, leave, replaced container (crafting table, trading) or failed open each count once (`guest_container_closed`). Spectators don't count, as in vanilla. - Guest: `tick_remote` ticks block entity animations. `BlockEvent` is applied when the block is still the one it names. - Server-only effects stay off on a guest: bell resonance, raider glow and the end gateway's server tick. - The agent's `block` query reports `lid` (chest lid or shulker progress) for the test. ## How tested **Two-client test** (`tools/lan_e2e.py`, its own PR, #424): a host and a guest, both real games offscreen on the Mac mini, the guest joining over `127.0.0.1`. Each check is reported on its own, with screenshots of both sides. | check | origin/main | this branch alone | all six fixes merged | |---|---|---|---| | chest | FAIL (lid 0.0 / 0.0 while the guest has it open) | PASS (open 1.0 / 1.0, closed 0 / 0) | PASS | Screenshots, before and after, both sides: `~/code/horizon-parity/shots/lan/` (`before-*`, `*-after-*`, `after-all-*`). **Self-check** on the integration commit (origin/main + the six LAN fixes): ``` cargo fmt --all --check clean cargo clippy --workspace --all-targets -- -D warnings clean (exit 0) cargo test -p horizon-client 743 passed, 0 failed tools/parity.py --changed origin/main 81 harnesses depend on the change: 81 passed, 0 failed ``` ## What needs Ludovic - Nothing to decide. Not tested: two physical machines (every run was host and guest on one Mac over loopback). Fixes #366 (one of six PRs; merge order: self-model, armour, chest lids, name tags, crafting, damage, then the test). 🤖 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:11 +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#2558
No description provided.