[PR #5287] [MERGED] Native mods: menu_button_v2, a mod menu button with the clicking player's cursor stack #6189

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

📋 Pull Request Information

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

Base: main ← Head: menu-button-v2


📝 Commits (3)

  • dfd7903 Native mods: menu_button_v2, a mod menu button with the clicking player's cursor stack
  • 9971d32 Merge remote-tracking branch 'origin/main' into menu-button-v2
  • 62d1ce8 Merge main into #5287 (main's clippy fix 825a6bbcf)

📊 Changes

3 files changed (+41 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/game/lan_stations.rs (+13 -1)
📝 crates/horizon-client/src/game/native_hooks.rs (+18 -2)
➕ tools/native-hook-fragments/menu_button_v2.json (+10 -0)

📄 Description

🤖 Opened by Sylviromi's AI agent (Claude Code, Claude Sonnet 5), not by Sylviromi personally.

What and why

native_menu_button_v2(pos, entity, id, carried: &mut Option<ItemStack>) is the counterpart of vanilla
AbstractContainerMenu.clickMenuButton(Player, int), which reaches the player's carried stack.
native_menu_button(pos, entity, id) does not, so a mod's widget outside the slots (a tank taking a
bucket from the cursor) cannot take or give what the player carries. native_menu_button_v2 fires right
after native_menu_button (unchanged, frozen per docs/native-hooks-neoforge.md rule 6). A change to
carried is written back and sent to the player with SetCursorItem. Single player's player is a guest
of its own host, so one path covers both single player and LAN guests. The API number comes from the
fragment tools/native-hook-fragments/menu_button_v2.json, stamped after merge per that fragment
directory's README.

Closes #5246

Kind

  • feature: something new for players (listed under New in the release notes)

Vanilla reference

AbstractContainerMenu.clickMenuButton(Player, int).

Other projects' code

none

Self-check

pr_ready: 6 files changed since origin/main; checks on local
  Public tree...
  Public tree: pass (0 s)
  Python tests...
  Python tests: pass (34 s)
  rustfmt...
  rustfmt: pass (7 s)
  clippy...
  clippy: pass (1 min 26 s)
  tests: horizon-client...

---- the_prediction_records_each_client_tick_and_the_server_ticks_it_had_seen stdout ----

thread 'the_prediction_records_each_client_tick_and_the_server_ticks_it_had_seen' (493567) panicked at crates/horizon-client/tests/lan_bot.rs:1206:10:
the prediction records

---- a_respawned_guest_is_immune_until_its_client_loads_the_world stdout ----

thread 'a_respawned_guest_is_immune_until_its_client_loads_the_world' (493559) panicked at crates/horizon-client/tests/lan_bot.rs:1284:5:
the packet marks it loaded

---- status_and_join stdout ----

thread '<unnamed>' (493655) panicked at crates/horizon-client/tests/lan_bot.rs:788:9:
assertion `left == right` failed: placed block was not broadcast
  left: None
 right: Some(([9, -59, 9], 1))

thread 'status_and_join' (493566) panicked at crates/horizon-client/tests/lan_bot.rs:290:19:
called `Result::unwrap()` on an `Err` value: Any { .. }

---- guests_see_each_other_and_the_world_entities stdout ----

thread 'guests_see_each_other_and_the_world_entities' (493563) panicked at crates/horizon-client/tests/lan_bot.rs:918:27:
called `Result::unwrap()` on an `Err` value: "zombies 0 players 1 moves 32"


failures:
    a_move_behind_a_use_on_a_block_and_its_swing_waits_for_the_next_tick
    a_respawned_guest_is_immune_until_its_client_loads_the_world
    guests_see_each_other_and_the_world_entities
    recipe_settings_packets_update_only_the_players_book_and_survive_save
    sprint_commands_survive_keyboard_input_changes
    status_and_join
    the_prediction_records_each_client_tick_and_the_server_ticks_it_had_seen

test result: FAILED. 6 passed; 7 failed; 0 ignored; 0 measured; 0 filtered out; finished in 20.64s

error: test failed, to rerun pass `-p horizon-client --test lan_bot`

  tests: horizon-client: fail (4 min 22 s)
  doc tests...
  doc tests: pass (2 s)
  launcher rustfmt...
  launcher rustfmt: pass (1 s)
  launcher clippy...
  launcher clippy: pass (9 s)
  launcher tests...
test skins::tests::only_skin_and_cape_sizes_are_kept ... ok
test themes::tests::a_background_is_a_picture_kept_once ... ok
test backend::release_loading_tests::one_response_preserves_both_startup_results ... ok
test backend::java_tests::selected_jdk_reaches_external_preparers ... ok
test instances::tests::a_picture_is_kept_small_and_goes_to_the_trash ... ok
test mojang::tests::a_file_of_another_size_than_mojang_lists_is_refused ... ok
test mojang::tests::a_file_that_is_not_the_pinned_one_stops_the_download ... ok
test mojang::tests::java_runtime_lays_out_mojangs_runtime_with_its_executables_and_links ... ok
test rust_toolchain::tests::builds_run_at_the_lowest_priority ... ok
test mojang::tests::a_download_goes_on_past_an_asset_that_keeps_failing ... ok
test mojang::tests::macos_skips_what_its_rules_disallow ... ok
test mojang::tests::missing_sounds_are_a_line_in_the_log_not_an_error ... ok
test mojang::tests::a_cancelled_download_goes_on_where_it_stopped ... ok
test i18n::tests::polish_entries_are_valid_and_keep_placeholders ... ok
test i18n::tests::every_language_has_every_string_the_code_asks_for ... FAILED
test mojang::tests::an_owner_gets_the_official_layout_with_this_systems_libraries ... ok
test mojang::tests::any_listed_version_comes_with_its_natives ... ok
test account::tests::the_whole_chain ... ok

failures:

---- i18n::tests::every_language_has_every_string_the_code_asks_for stdout ----

thread 'i18n::tests::every_language_has_every_string_the_code_asks_for' (496661) panicked at src/i18n/tests.rs:137:9:
lang/fr.json lacks [
    "Install and turn on native mods",
    "Native mods (experimental)",
    "Native mods compile into a game of their own. Installing one turns Native mods on: you then build the game with it in Settings > Native mods. The first build downloads Rust and can take 20 to 30 minutes; later builds are faster.",
    "Native mods from the Mods page compile into the game with the launcher's own Rust. Not sandboxed: they can do anything you can on this computer.",
    "{version} plays in this instance.",
]


failures:
    i18n::tests::every_language_has_every_string_the_code_asks_for

test result: FAILED. 333 passed; 1 failed; 3 ignored; 0 measured; 0 filtered out; finished in 3.01s

error: test failed, to rerun pass `--lib`

  launcher tests: fail (22 s)
**pr_ready** (`tools/pr_ready.py --quick` on boilingpoint, against origin/main at 571ec1b76, 7 min 3 s)

| Check | Result |
| --- | --- |
| Scope | ⚠️ 6 files, +42 −3; mixes game, launcher |
| Cargo.lock | ✅ unchanged |
| Public tree | ✅ |
| Python tests | ✅ 499 passed (34 s) |
| rustfmt | ✅ (7 s) |
| clippy | ✅ (1 min 26 s) |
| tests: horizon-client | ❌ 1394 passed, 7 failed (4 min 22 s) |
| doc tests | ✅ 0 passed (2 s) |
| content root tests | ➖ content root untouched |
| tokens.css up to date | ➖ theme untouched |
| launcher rustfmt | ✅ (1 s) |
| launcher clippy | ✅ (9 s) |
| launcher tests | ❌ 333 passed, 1 failed (22 s) |
| Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses |
| Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) |

Both failing checks also fail on plain origin/main at 571ec1b76, without this change:

  • crates/horizon-client/tests/lan_bot.rs status_and_join (and its siblings) reproduce on plain main,
    unrelated to this branch.
  • The launcher's i18n::tests::every_language_has_every_string_the_code_asks_for: lang/fr.json lacks
    "Install and turn on native mods" / "Native mods (experimental)" and the other strings above, already
    missing on main.

The "mixes game, launcher" scope note above counts untracked build links in the working tree, not actual
changes: the real diff is 3 files, all under crates/horizon-client and tools/native-hook-fragments.

Screenshots

None (server-side hook, nothing new to see yet).


Draft because the first mod using this hook is still being written.

🤖 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/5287 **Author:** [@Sylviromi](https://github.com/Sylviromi) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `menu-button-v2` --- ### 📝 Commits (3) - [`dfd7903`](https://github.com/horizon-rust/horizon/commit/dfd7903066f25e2c68f42836faa118a5a12814c1) Native mods: menu_button_v2, a mod menu button with the clicking player's cursor stack - [`9971d32`](https://github.com/horizon-rust/horizon/commit/9971d320d3aee79969b81674a083afabb8580b0f) Merge remote-tracking branch 'origin/main' into menu-button-v2 - [`62d1ce8`](https://github.com/horizon-rust/horizon/commit/62d1ce8e1b2aa665448204053c43d096706cf474) Merge main into #5287 (main's clippy fix 825a6bbcf) ### 📊 Changes **3 files changed** (+41 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan_stations.rs` (+13 -1) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+18 -2) ➕ `tools/native-hook-fragments/menu_button_v2.json` (+10 -0) </details> ### 📄 Description > 🤖 Opened by Sylviromi's AI agent (Claude Code, Claude Sonnet 5), not by Sylviromi personally. ## What and why `native_menu_button_v2(pos, entity, id, carried: &mut Option<ItemStack>)` is the counterpart of vanilla `AbstractContainerMenu.clickMenuButton(Player, int)`, which reaches the player's carried stack. `native_menu_button(pos, entity, id)` does not, so a mod's widget outside the slots (a tank taking a bucket from the cursor) cannot take or give what the player carries. `native_menu_button_v2` fires right after `native_menu_button` (unchanged, frozen per `docs/native-hooks-neoforge.md` rule 6). A change to `carried` is written back and sent to the player with `SetCursorItem`. Single player's player is a guest of its own host, so one path covers both single player and LAN guests. The API number comes from the fragment `tools/native-hook-fragments/menu_button_v2.json`, stamped after merge per that fragment directory's README. Closes #5246 ## Kind - [x] feature: something new for players (listed under New in the release notes) ## Vanilla reference `AbstractContainerMenu.clickMenuButton(Player, int)`. ## Other projects' code none ## Self-check ``` pr_ready: 6 files changed since origin/main; checks on local Public tree... Public tree: pass (0 s) Python tests... Python tests: pass (34 s) rustfmt... rustfmt: pass (7 s) clippy... clippy: pass (1 min 26 s) tests: horizon-client... ---- the_prediction_records_each_client_tick_and_the_server_ticks_it_had_seen stdout ---- thread 'the_prediction_records_each_client_tick_and_the_server_ticks_it_had_seen' (493567) panicked at crates/horizon-client/tests/lan_bot.rs:1206:10: the prediction records ---- a_respawned_guest_is_immune_until_its_client_loads_the_world stdout ---- thread 'a_respawned_guest_is_immune_until_its_client_loads_the_world' (493559) panicked at crates/horizon-client/tests/lan_bot.rs:1284:5: the packet marks it loaded ---- status_and_join stdout ---- thread '<unnamed>' (493655) panicked at crates/horizon-client/tests/lan_bot.rs:788:9: assertion `left == right` failed: placed block was not broadcast left: None right: Some(([9, -59, 9], 1)) thread 'status_and_join' (493566) panicked at crates/horizon-client/tests/lan_bot.rs:290:19: called `Result::unwrap()` on an `Err` value: Any { .. } ---- guests_see_each_other_and_the_world_entities stdout ---- thread 'guests_see_each_other_and_the_world_entities' (493563) panicked at crates/horizon-client/tests/lan_bot.rs:918:27: called `Result::unwrap()` on an `Err` value: "zombies 0 players 1 moves 32" failures: a_move_behind_a_use_on_a_block_and_its_swing_waits_for_the_next_tick a_respawned_guest_is_immune_until_its_client_loads_the_world guests_see_each_other_and_the_world_entities recipe_settings_packets_update_only_the_players_book_and_survive_save sprint_commands_survive_keyboard_input_changes status_and_join the_prediction_records_each_client_tick_and_the_server_ticks_it_had_seen test result: FAILED. 6 passed; 7 failed; 0 ignored; 0 measured; 0 filtered out; finished in 20.64s error: test failed, to rerun pass `-p horizon-client --test lan_bot` tests: horizon-client: fail (4 min 22 s) doc tests... doc tests: pass (2 s) launcher rustfmt... launcher rustfmt: pass (1 s) launcher clippy... launcher clippy: pass (9 s) launcher tests... test skins::tests::only_skin_and_cape_sizes_are_kept ... ok test themes::tests::a_background_is_a_picture_kept_once ... ok test backend::release_loading_tests::one_response_preserves_both_startup_results ... ok test backend::java_tests::selected_jdk_reaches_external_preparers ... ok test instances::tests::a_picture_is_kept_small_and_goes_to_the_trash ... ok test mojang::tests::a_file_of_another_size_than_mojang_lists_is_refused ... ok test mojang::tests::a_file_that_is_not_the_pinned_one_stops_the_download ... ok test mojang::tests::java_runtime_lays_out_mojangs_runtime_with_its_executables_and_links ... ok test rust_toolchain::tests::builds_run_at_the_lowest_priority ... ok test mojang::tests::a_download_goes_on_past_an_asset_that_keeps_failing ... ok test mojang::tests::macos_skips_what_its_rules_disallow ... ok test mojang::tests::missing_sounds_are_a_line_in_the_log_not_an_error ... ok test mojang::tests::a_cancelled_download_goes_on_where_it_stopped ... ok test i18n::tests::polish_entries_are_valid_and_keep_placeholders ... ok test i18n::tests::every_language_has_every_string_the_code_asks_for ... FAILED test mojang::tests::an_owner_gets_the_official_layout_with_this_systems_libraries ... ok test mojang::tests::any_listed_version_comes_with_its_natives ... ok test account::tests::the_whole_chain ... ok failures: ---- i18n::tests::every_language_has_every_string_the_code_asks_for stdout ---- thread 'i18n::tests::every_language_has_every_string_the_code_asks_for' (496661) panicked at src/i18n/tests.rs:137:9: lang/fr.json lacks [ "Install and turn on native mods", "Native mods (experimental)", "Native mods compile into a game of their own. Installing one turns Native mods on: you then build the game with it in Settings > Native mods. The first build downloads Rust and can take 20 to 30 minutes; later builds are faster.", "Native mods from the Mods page compile into the game with the launcher's own Rust. Not sandboxed: they can do anything you can on this computer.", "{version} plays in this instance.", ] failures: i18n::tests::every_language_has_every_string_the_code_asks_for test result: FAILED. 333 passed; 1 failed; 3 ignored; 0 measured; 0 filtered out; finished in 3.01s error: test failed, to rerun pass `--lib` launcher tests: fail (22 s) **pr_ready** (`tools/pr_ready.py --quick` on boilingpoint, against origin/main at 571ec1b76, 7 min 3 s) | Check | Result | | --- | --- | | Scope | ⚠️ 6 files, +42 −3; mixes game, launcher | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 499 passed (34 s) | | rustfmt | ✅ (7 s) | | clippy | ✅ (1 min 26 s) | | tests: horizon-client | ❌ 1394 passed, 7 failed (4 min 22 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (1 s) | | launcher clippy | ✅ (9 s) | | launcher tests | ❌ 333 passed, 1 failed (22 s) | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | ``` Both failing checks also fail on plain `origin/main` at `571ec1b76`, without this change: - `crates/horizon-client/tests/lan_bot.rs` `status_and_join` (and its siblings) reproduce on plain `main`, unrelated to this branch. - The launcher's `i18n::tests::every_language_has_every_string_the_code_asks_for`: `lang/fr.json` lacks "Install and turn on native mods" / "Native mods (experimental)" and the other strings above, already missing on `main`. The "mixes game, launcher" scope note above counts untracked build links in the working tree, not actual changes: the real diff is 3 files, all under `crates/horizon-client` and `tools/native-hook-fragments`. ## Screenshots None (server-side hook, nothing new to see yet). --- Draft because the first mod using this hook is still being written. 🤖 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-03 06:15:41 +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#6189
No description provided.