[PR #2960] [MERGED] Show shelf contents and let players swap items with shelves #4714

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

📋 Pull Request Information

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

Base: main ← Head: fix/shelf-interaction


📝 Commits (7)

  • ca28a0e Show items revealed by brushing suspicious blocks
  • 2deaab2 Render items stored in shelves
  • 42388d2 Swap items with shelves and powered shelf chains
  • 3267195 Merge main into fix/shelf-interaction
  • cef8624 Merge main into this branch
  • 98c0883 Merge main into this branch; suspicious blocks are not containers
  • 38da7d8 Merge main into this branch

📊 Changes

11 files changed (+499 additions, -21 deletions)

View changed files

📝 crates/horizon-client-render/src/chunk/block_entity.rs (+19 -0)
📝 crates/horizon-client-render/src/containers.rs (+24 -5)
📝 crates/horizon-client/src/game.rs (+17 -2)
📝 crates/horizon-client/src/game/brush.rs (+94 -6)
📝 crates/horizon-client/src/game/machines.rs (+19 -7)
📝 crates/horizon-client/src/game/remote.rs (+10 -0)
➕ crates/horizon-client/src/game/shelf.rs (+260 -0)
📝 crates/horizon-client/src/lan/chunks.rs (+17 -0)
📝 crates/horizon-client/src/save.rs (+33 -0)
📝 crates/horizon-client/src/vanillagen.rs (+1 -1)
📝 crates/horizon-items/src/items.rs (+5 -0)

📄 Description

Depends on #2959; review after it.

What and why

Shelves held no items in Horizon: the three slots were not modelled, drawn or usable.

  • Shelves are block entities with three slots and the align-to-bottom flag. They are saved, loaded and sent to LAN and integrated-server clients.
  • The three items are drawn on the shelf front, centred or on the bottom, using the on-shelf display of each item.
  • Using an unpowered shelf swaps the held item with the slot you click (creative keeps the held item when the slot was empty). It plays the place, take or swap sound and sends the item-interact vibration unless the item turns it off.
  • Using a powered shelf swaps the three hotbar slots in line with it, and up to three connected powered shelves swap their hotbar groups, with the multi-swap sound.
  • On a server, a click with a held item is consumed on the client without predicting the swap or swinging the arm, as vanilla does.
  • item_used_on_block advancements fire, and the comparator reads the shelf contents from the new slots.

Vanilla reference

  • ShelfBlockEntity.java:34-70: three item slots, align_items_to_bottom, save and load.
  • ShelfRenderer.java:42-95: item placement on the shelf.
  • ShelfBlock.java:145-224: single swap, hotbar swap, sounds and game events.
  • SideChainPartBlock.java:26-47: the connected shelves of a chain.
  • SelectableSlotContainer.java:16-50: which slot a click hits.
  • UseEffects.java:9-18: interact_vibrations.

Self-check

clippy and fmt pass for horizon-client. Not run in game.


🔄 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/2960 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/shelf-interaction` --- ### 📝 Commits (7) - [`ca28a0e`](https://github.com/horizon-rust/horizon/commit/ca28a0edadead21adfba5ec86b9f88fc39e992c4) Show items revealed by brushing suspicious blocks - [`2deaab2`](https://github.com/horizon-rust/horizon/commit/2deaab2602f9fdf1d503b32f6fce93f4a0ee6561) Render items stored in shelves - [`42388d2`](https://github.com/horizon-rust/horizon/commit/42388d25126508d4fe9ef1e104850297aa774078) Swap items with shelves and powered shelf chains - [`3267195`](https://github.com/horizon-rust/horizon/commit/326719539d2ddcde4466a6c27c6504f526cf9797) Merge main into fix/shelf-interaction - [`cef8624`](https://github.com/horizon-rust/horizon/commit/cef862471f5285a3aeb42be33512b8cdf81a7049) Merge main into this branch - [`98c0883`](https://github.com/horizon-rust/horizon/commit/98c0883c8f167973a6d1648dafeddd53e191163d) Merge main into this branch; suspicious blocks are not containers - [`38da7d8`](https://github.com/horizon-rust/horizon/commit/38da7d8d6e78526c0522904717143125453d32c7) Merge main into this branch ### 📊 Changes **11 files changed** (+499 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/chunk/block_entity.rs` (+19 -0) 📝 `crates/horizon-client-render/src/containers.rs` (+24 -5) 📝 `crates/horizon-client/src/game.rs` (+17 -2) 📝 `crates/horizon-client/src/game/brush.rs` (+94 -6) 📝 `crates/horizon-client/src/game/machines.rs` (+19 -7) 📝 `crates/horizon-client/src/game/remote.rs` (+10 -0) ➕ `crates/horizon-client/src/game/shelf.rs` (+260 -0) 📝 `crates/horizon-client/src/lan/chunks.rs` (+17 -0) 📝 `crates/horizon-client/src/save.rs` (+33 -0) 📝 `crates/horizon-client/src/vanillagen.rs` (+1 -1) 📝 `crates/horizon-items/src/items.rs` (+5 -0) </details> ### 📄 Description Depends on #2959; review after it. ## What and why Shelves held no items in Horizon: the three slots were not modelled, drawn or usable. - Shelves are block entities with three slots and the align-to-bottom flag. They are saved, loaded and sent to LAN and integrated-server clients. - The three items are drawn on the shelf front, centred or on the bottom, using the on-shelf display of each item. - Using an unpowered shelf swaps the held item with the slot you click (creative keeps the held item when the slot was empty). It plays the place, take or swap sound and sends the item-interact vibration unless the item turns it off. - Using a powered shelf swaps the three hotbar slots in line with it, and up to three connected powered shelves swap their hotbar groups, with the multi-swap sound. - On a server, a click with a held item is consumed on the client without predicting the swap or swinging the arm, as vanilla does. - `item_used_on_block` advancements fire, and the comparator reads the shelf contents from the new slots. ## Vanilla reference - `ShelfBlockEntity.java:34-70`: three item slots, `align_items_to_bottom`, save and load. - `ShelfRenderer.java:42-95`: item placement on the shelf. - `ShelfBlock.java:145-224`: single swap, hotbar swap, sounds and game events. - `SideChainPartBlock.java:26-47`: the connected shelves of a chain. - `SelectableSlotContainer.java:16-50`: which slot a click hits. - `UseEffects.java:9-18`: `interact_vibrations`. ## Self-check clippy and fmt pass for horizon-client. Not run in game. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:07:23 +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#4714
No description provided.