[PR #1848] [MERGED] Keep shulker boxes out of shulker boxes on the server #3813

Closed
opened 2026-11-03 04:12:29 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/1501-shulker-nesting


📝 Commits (2)

  • 0c01767 Keep shulker boxes out of shulker boxes on the server
  • 0298d10 Shulker boxes: one canFitInsideContainerItems for both menus, and a unit test

📊 Changes

3 files changed (+78 additions, -19 deletions)

View changed files

📝 crates/horizon-client/src/lan/containers.rs (+9 -0)
📝 crates/horizon-client/src/lan/menu.rs (+62 -13)
📝 crates/horizon-client/src/menu.rs (+7 -6)

📄 Description

What and why

Fixes #1501.

With the server thread, a shulker box could be put inside another shulker box. The client's menu already has the rule (Role::Shulker in menu.rs), but the server's menus for guests (lan::menu::View) treated a shulker box's slots like a chest's, so the server accepted the click and stored the box.

View now knows when the open menu is a shulker box (container_click compares the menu's type with minecraft:shulker_box), and may_place then refuses any shulker box in the container's own slots, as ShulkerBoxSlot.mayPlace does. Every click path already asks may_place, so pickup, shift-click, the number keys and drags all reject the box. The item stays where it was, and other items still go in normally. Other containers still accept shulker boxes.

Vanilla reference

  • ShulkerBoxSlot.mayPlace (itemStack.getItem().canFitInsideContainerItems())
  • BlockItem.canFitInsideContainerItems (!(getBlock() instanceof ShulkerBoxBlock))

No harness covers the server's guest menus: menu_click runs only the client's horizon_client::menu, which already had this rule. I checked it with a throwaway unit check over lan::menu::click: in a shulker box view, a carried red shulker box clicked onto an empty slot, shift-clicked from the hotbar, or swapped in with a number key stays out (slot empty, item kept); a diamond goes in each way; in a non-shulker view the red shulker box goes in, as before. The existing lan:: unit tests pass (48 passed) and cargo check -p horizon-client --tests is clean. I did not run the game itself in server-thread mode.

Self-check

pr_ready (tools/pr_ready.py --quick on device-591, against origin/main at bd591f985, 3 min 10 s)

Check Result
Scope ✅ 2 files, +20 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (5 s)
clippy ✅ (11 s)
tests: horizon-client ✅ 1236 passed (2 min 50 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 330 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 318 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🔄 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/1848 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/1501-shulker-nesting` --- ### 📝 Commits (2) - [`0c01767`](https://github.com/horizon-rust/horizon/commit/0c017678eb50c5819f0e2948f3f8432093e027ac) Keep shulker boxes out of shulker boxes on the server - [`0298d10`](https://github.com/horizon-rust/horizon/commit/0298d109886f0679f3a3ae11d001f0b81224026c) Shulker boxes: one canFitInsideContainerItems for both menus, and a unit test ### 📊 Changes **3 files changed** (+78 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/lan/containers.rs` (+9 -0) 📝 `crates/horizon-client/src/lan/menu.rs` (+62 -13) 📝 `crates/horizon-client/src/menu.rs` (+7 -6) </details> ### 📄 Description ## What and why Fixes #1501. With the server thread, a shulker box could be put inside another shulker box. The client's menu already has the rule (`Role::Shulker` in `menu.rs`), but the server's menus for guests (`lan::menu::View`) treated a shulker box's slots like a chest's, so the server accepted the click and stored the box. `View` now knows when the open menu is a shulker box (`container_click` compares the menu's type with `minecraft:shulker_box`), and `may_place` then refuses any shulker box in the container's own slots, as `ShulkerBoxSlot.mayPlace` does. Every click path already asks `may_place`, so pickup, shift-click, the number keys and drags all reject the box. The item stays where it was, and other items still go in normally. Other containers still accept shulker boxes. ## Vanilla reference - `ShulkerBoxSlot.mayPlace` (`itemStack.getItem().canFitInsideContainerItems()`) - `BlockItem.canFitInsideContainerItems` (`!(getBlock() instanceof ShulkerBoxBlock)`) No harness covers the server's guest menus: `menu_click` runs only the client's `horizon_client::menu`, which already had this rule. I checked it with a throwaway unit check over `lan::menu::click`: in a shulker box view, a carried red shulker box clicked onto an empty slot, shift-clicked from the hotbar, or swapped in with a number key stays out (slot empty, item kept); a diamond goes in each way; in a non-shulker view the red shulker box goes in, as before. The existing `lan::` unit tests pass (48 passed) and `cargo check -p horizon-client --tests` is clean. I did not run the game itself in server-thread mode. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on device-591, against origin/main at bd591f985, 3 min 10 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +20 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (5 s) | | clippy | ✅ (11 s) | | tests: horizon-client | ✅ 1236 passed (2 min 50 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 330 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 318 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:12:29 +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#3813
No description provided.