[PR #5148] [MERGED] Mod screens on hopper menus get their own slots back #6101

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

📋 Pull Request Information

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

Base: main ← Head: fix/mod-screen-on-machine-menus


📝 Commits (1)

  • 40fa42e Mod screens on hopper menus get their own slots back

📊 Changes

2 files changed (+37 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+31 -1)
📝 crates/horizon-client/src/game/native_hooks.rs (+6 -0)

📄 Description

🤖 Opened by sirrayi's AI agent (DeepSeek Harness, deepseek-v4.1-flash), not by sirrayi themselves.

What and why

Fixes #5141, one item from #4953. A native mod's screen on a minecraft:hopper or
minecraft:generic_3x3 menu drew its own background and height but no slot of its own: Game::slot_position
asks machine_slot_position (the hopper's and dispenser's stock grid) before its 300..500 native-screen
arm (game.rs — the station_slot_position chain versus the native_screen_slot arm), and that grid answers
for the player's inventory too, so native_screen_inventory_y/_x never applied either.

The rest of those menus was already the mod's, which is what made the layout inconsistent rather than simply
wrong: draw_native_screen is the first arm of the container-background match, so a shown mod screen owns the
background, and screen_height already prefers native_screen_height(). Only the slots were still the
stock ones.

So the stock grid now stands back while a mod screen is shown, and nothing else changes:

fn stock_machine_slot(stock: Option<(f32, f32)>, mod_screen_shown: bool) -> Option<(f32, f32)> {
    if mod_screen_shown { None } else { stock }
}

Invisible without native mods: native_screen_shown() is shown_native_screen().is_some(), which cannot
hold unless a mod called native_screen. With no mod screen the hopper and dispenser layouts answer exactly
as they do today, which the test asserts directly.

Kind

  • bug: a crash or a breakage

Vanilla reference

None: vanilla has no mod screens. The vanilla half is untouched — the hopper's and dispenser's own layouts
(HopperMenu 5 slots, DispenserMenu 3x3) are unchanged, and this only decides which layout answers when a
mod screen is open over one of those menus.

Self-check

cargo fmt --all -- --check                                    ✅
cargo clippy -p horizon-client --bins --tests -- -D warnings    ✅
cargo test -p horizon-client --bins a_mod_screen_on_a_machine_menu
                                                              1 passed; 0 failed

Exit codes were read with set -o pipefail, not from tail.

What I could not verify, and how to check it in a minute

I have no prepared resources or display on this machine, so I could not look at the screen; the test pins the
precedence rule, not the pixels. The check, in the game with a sample machine mod (the one this item was found
with):

  1. Open a mod screen on a hopper menu, and on a dispenser.
  2. Its own container slots should be where the mod declares them, not on the stock 5-slot row or the 3x3 grid,
    and the player's inventory should sit at the screen's inventory_y.
  3. With no mod screen, a hopper and a dispenser must look exactly as before — no change to a player who runs no
    native mods.

If the report's other half is real — the stock "Inventory" label drawn over the mod's slots — that does not
reproduce from this code path, because draw_native_screen wins the background match for any shown mod screen
and draw_machine_screen is then never reached. If a maintainer sees the label anyway, the screen is probably
drawn by a path I have not found, and I would rather be told than guess.


🔄 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/5148 **Author:** [@sirrayi](https://github.com/sirrayi) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/mod-screen-on-machine-menus` --- ### 📝 Commits (1) - [`40fa42e`](https://github.com/horizon-rust/horizon/commit/40fa42e2390cbcd5ed2f76b0c74848600f709e29) Mod screens on hopper menus get their own slots back ### 📊 Changes **2 files changed** (+37 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+31 -1) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+6 -0) </details> ### 📄 Description > 🤖 Opened by sirrayi's AI agent (DeepSeek Harness, deepseek-v4.1-flash), not by sirrayi themselves. ## What and why Fixes #5141, one item from #4953. A native mod's screen on a `minecraft:hopper` or `minecraft:generic_3x3` menu drew its own background and height but no slot of its own: `Game::slot_position` asks `machine_slot_position` (the hopper's and dispenser's stock grid) before its `300..500` native-screen arm (`game.rs` — the `station_slot_position` chain versus the `native_screen_slot` arm), and that grid answers for the player's inventory too, so `native_screen_inventory_y`/`_x` never applied either. The rest of those menus was already the mod's, which is what made the layout inconsistent rather than simply wrong: `draw_native_screen` is the first arm of the container-background match, so a shown mod screen owns the background, and `screen_height` already prefers `native_screen_height()`. Only the slots were still the stock ones. So the stock grid now stands back while a mod screen is shown, and nothing else changes: ```rust fn stock_machine_slot(stock: Option<(f32, f32)>, mod_screen_shown: bool) -> Option<(f32, f32)> { if mod_screen_shown { None } else { stock } } ``` **Invisible without native mods**: `native_screen_shown()` is `shown_native_screen().is_some()`, which cannot hold unless a mod called `native_screen`. With no mod screen the hopper and dispenser layouts answer exactly as they do today, which the test asserts directly. ## Kind - [x] bug: a crash or a breakage ## Vanilla reference None: vanilla has no mod screens. The vanilla half is untouched — the hopper's and dispenser's own layouts (`HopperMenu` 5 slots, `DispenserMenu` 3x3) are unchanged, and this only decides *which* layout answers when a mod screen is open over one of those menus. ## Self-check ``` cargo fmt --all -- --check ✅ cargo clippy -p horizon-client --bins --tests -- -D warnings ✅ cargo test -p horizon-client --bins a_mod_screen_on_a_machine_menu 1 passed; 0 failed ``` Exit codes were read with `set -o pipefail`, not from `tail`. ## What I could not verify, and how to check it in a minute I have no prepared resources or display on this machine, so I could not look at the screen; the test pins the precedence rule, not the pixels. The check, in the game with a sample machine mod (the one this item was found with): 1. Open a mod screen on a hopper menu, and on a dispenser. 2. Its own container slots should be where the mod declares them, not on the stock 5-slot row or the 3x3 grid, and the player's inventory should sit at the screen's `inventory_y`. 3. With no mod screen, a hopper and a dispenser must look exactly as before — no change to a player who runs no native mods. If the report's other half is real — the stock "Inventory" label drawn over the mod's slots — that does not reproduce from this code path, because `draw_native_screen` wins the background match for any shown mod screen and `draw_machine_screen` is then never reached. If a maintainer sees the label anyway, the screen is probably drawn by a path I have not found, and I would rather be told than guess. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:11:39 +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#6101
No description provided.