[PR #2641] [MERGED] Read a chiseled bookshelf's last slot and a shelf's back mask with a comparator #4496

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

📋 Pull Request Information

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

Base: main ← Head: fix/bookshelf-shelf-comparator


📝 Commits (1)

  • ff28fd8 Read a chiseled bookshelf's last slot and a shelf's back mask with a comparator

📊 Changes

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

View changed files

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

📄 Description

What and why

A comparator next to a chiseled bookshelf or a shelf did not read what vanilla reads. Both blocks are kept as loaded data in Horizon (they are not container block entities), so the comparator got 0 from them.

Now:

  • A chiseled bookshelf gives last_interacted_slot + 1 (0 when it was never used), read from the saved block entity data.
  • A shelf gives 0 unless the comparator is behind it (on the side opposite its facing). From the back it gives a 3-bit number: one bit for each of its three slots that holds an item.

Putting books into and taking them out of these blocks is not implemented in Horizon yet, so nothing updates last_interacted_slot while playing. The value from the saved data is kept as it is when the world is saved, the same way vanilla stores it.

Vanilla reference

  • ChiseledBookShelfBlock.getAnalogOutputSignal: getLastInteractedSlot() + 1.
  • ChiseledBookShelfBlockEntity.loadAdditional / saveAdditional: the last_interacted_slot tag, default -1.
  • ShelfBlock.getAnalogOutputSignal: 0 unless direction == FACING.getOpposite(), then item1Bit | item2Bit << 1 | item3Bit << 2.

Self-check

cargo check -p horizon-client passes.


🔄 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/2641 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/bookshelf-shelf-comparator` --- ### 📝 Commits (1) - [`ff28fd8`](https://github.com/horizon-rust/horizon/commit/ff28fd839036a7c3f88203a428bd6c23a92963f9) Read a chiseled bookshelf's last slot and a shelf's back mask with a comparator ### 📊 Changes **2 files changed** (+45 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+6 -1) 📝 `crates/horizon-client/src/game/machines.rs` (+39 -0) </details> ### 📄 Description ## What and why A comparator next to a chiseled bookshelf or a shelf did not read what vanilla reads. Both blocks are kept as loaded data in Horizon (they are not container block entities), so the comparator got 0 from them. Now: - A chiseled bookshelf gives `last_interacted_slot + 1` (0 when it was never used), read from the saved block entity data. - A shelf gives 0 unless the comparator is behind it (on the side opposite its facing). From the back it gives a 3-bit number: one bit for each of its three slots that holds an item. Putting books into and taking them out of these blocks is not implemented in Horizon yet, so nothing updates `last_interacted_slot` while playing. The value from the saved data is kept as it is when the world is saved, the same way vanilla stores it. ## Vanilla reference - `ChiseledBookShelfBlock.getAnalogOutputSignal`: `getLastInteractedSlot() + 1`. - `ChiseledBookShelfBlockEntity.loadAdditional` / `saveAdditional`: the `last_interacted_slot` tag, default -1. - `ShelfBlock.getAnalogOutputSignal`: 0 unless `direction == FACING.getOpposite()`, then `item1Bit | item2Bit << 1 | item3Bit << 2`. ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:17:35 +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#4496
No description provided.