[PR #6336] [CLOSED] Native mods: a player opening and closing a menu, PlayerContainerEvent #6809

Closed
opened 2026-11-03 06:27:19 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6336
Author: @MSedgeMC
Created: 11/1/2026
Status: ❌ Closed

Base: main ← Head: feat/md-container-events


📝 Commits (1)

  • 68b51c5 Native mods: a player opening and closing a menu, PlayerContainerEvent

📊 Changes

8 files changed (+189 additions, -10 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+1 -0)
📝 crates/horizon-client/src/game/lan.rs (+16 -0)
➕ crates/horizon-client/src/game/native_container_events.rs (+33 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+33 -0)
📝 crates/horizon-client/src/lan/containers.rs (+55 -10)
📝 crates/horizon-client/src/lan/hub.rs (+16 -0)
📝 crates/horizon-client/src/lan/menu.rs (+17 -0)
➕ tools/native-hook-fragments/player_container.json (+18 -0)

📄 Description

A mod must hear which player opened or closed which menu, and where, as
NeoForge's PlayerContainerEvent.Open/Close report it; the existing
native_mod_container_viewers gives only a count for the mod's own
containers.

The hub makes and drops a guest's menu in open_container,
open_native_menu, close_container_at and container_closed with no hook,
so a mod could not tell a chest from a furnace, or one player from another.

Proven: cargo test -q -p horizon-client --lib container on the build VM:
16 passed, 0 failed (1221 filtered out), and
cargo test -q -p horizon-client --bin horizon-client player_container
compiled the client's binary with the two hooks and their drain (0 failed).

Not proven: not fired in a running game: no test opens a world to the
network and opens a chest in it, so the recording points are proven to
compile, not to fire. The window's own player is not a guest, so its menus
are not told; trade, crafting-table, lectern and mount menus keep their own
state and are not told either.


🔄 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/6336 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/1/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/md-container-events` --- ### 📝 Commits (1) - [`68b51c5`](https://github.com/horizon-rust/horizon/commit/68b51c57c6b254d596eb5a3a5c92b17d58273eb9) Native mods: a player opening and closing a menu, PlayerContainerEvent ### 📊 Changes **8 files changed** (+189 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+1 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+16 -0) ➕ `crates/horizon-client/src/game/native_container_events.rs` (+33 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+33 -0) 📝 `crates/horizon-client/src/lan/containers.rs` (+55 -10) 📝 `crates/horizon-client/src/lan/hub.rs` (+16 -0) 📝 `crates/horizon-client/src/lan/menu.rs` (+17 -0) ➕ `tools/native-hook-fragments/player_container.json` (+18 -0) </details> ### 📄 Description A mod must hear which player opened or closed which menu, and where, as NeoForge's `PlayerContainerEvent.Open`/`Close` report it; the existing `native_mod_container_viewers` gives only a count for the mod's own containers. The hub makes and drops a guest's menu in `open_container`, `open_native_menu`, `close_container_at` and `container_closed` with no hook, so a mod could not tell a chest from a furnace, or one player from another. **Proven:** `cargo test -q -p horizon-client --lib container` on the build VM: 16 passed, 0 failed (1221 filtered out), and `cargo test -q -p horizon-client --bin horizon-client player_container` compiled the client's binary with the two hooks and their drain (0 failed). **Not proven:** not fired in a running game: no test opens a world to the network and opens a chest in it, so the recording points are proven to compile, not to fire. The window's own player is not a guest, so its menus are not told; trade, crafting-table, lectern and mount menus keep their own state and are not told either. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:27:19 +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#6809
No description provided.