[PR #6878] [MERGED] A jukebox placed from an item that carries a disc keeps it, and shows it #7167

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6878
Author: @MSedgeMC
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: fix/jukebox-placed-record


📝 Commits (1)

  • 32b3543 A jukebox placed from an item carrying a disc keeps it, and shows it

📊 Changes

5 files changed (+75 additions, -1 deletions)

View changed files

📝 crates/horizon-client-render/src/containers.rs (+17 -0)
📝 crates/horizon-client/src/block_entity_item.rs (+45 -0)
📝 crates/horizon-client/src/game.rs (+1 -0)
📝 crates/horizon-client/src/game/jukebox.rs (+11 -0)
📝 tools/port_map/game2-014.tsv (+1 -1)

📄 Description

Vanilla: BlockItem.place gives a placed jukebox its JukeboxBlockEntity and merges the item's minecraft:block_entity_data into it (updateCustomBlockEntityTag); JukeboxBlock.setPlacedBy then reads the item's data and, when it contains a RecordItem, sets the block's has_record to true with flag 2. So a jukebox placed from an item that carries a disc holds the disc, its model draws it, and a click pops it out.

Horizon got two things wrong on that path. BlockEntity::for_block had no minecraft:jukebox arm, so a placed jukebox got no block entity at all and the item's block entity data was dropped (a box only ever got one when a player put a disc in). And the Block.setPlacedBy dispatch in Game::use_hand had no jukebox arm, so even with a disc in the entity has_record stayed false: no disc model, and useWithoutItem would not hand the disc back.

Changes:

  • BlockEntity::for_block("minecraft:jukebox") starts a placed box as an empty jukebox entity, as JukeboxBlock.newBlockEntity does.
  • Game::jukebox_placed sets has_record through set_has_record (UPDATE_CLIENTS) when the item's data carries a RecordItem, as JukeboxBlock.setPlacedBy does, and the dispatch calls it after apply_placed_item.
  • the JukeboxBlock.setPlacedBy port map row now points at it.

Proven:

  • cargo test -q -p horizon-client-lib --lib a_jukebox_item_with_a_record -> 1 passed; 0 failed; ... 1382 filtered out.
  • cargo test -q -p horizon-client-render --lib a_placed_jukebox -> 1 passed; 0 failed; ... 1116 filtered out.
  • cargo clippy -q -p horizon-client-lib --lib, cargo clippy -q -p horizon-client-render --lib and cargo clippy -q -p horizon-client --lib print nothing.
  • rustfmt --edition 2024 --check on the four touched files is clean.

Not proven: the game itself was not run. In-game check: in Creative, Ctrl+pick a jukebox that holds a disc, then place it; the box holds the disc, its model shows it, and a right click pops it out. A plain jukebox still places empty with no disc model.


🔄 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/6878 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/jukebox-placed-record` --- ### 📝 Commits (1) - [`32b3543`](https://github.com/horizon-rust/horizon/commit/32b3543820dd2c67b08a7c0d33c5f092253d1668) A jukebox placed from an item carrying a disc keeps it, and shows it ### 📊 Changes **5 files changed** (+75 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/containers.rs` (+17 -0) 📝 `crates/horizon-client/src/block_entity_item.rs` (+45 -0) 📝 `crates/horizon-client/src/game.rs` (+1 -0) 📝 `crates/horizon-client/src/game/jukebox.rs` (+11 -0) 📝 `tools/port_map/game2-014.tsv` (+1 -1) </details> ### 📄 Description Vanilla: `BlockItem.place` gives a placed jukebox its `JukeboxBlockEntity` and merges the item's `minecraft:block_entity_data` into it (`updateCustomBlockEntityTag`); `JukeboxBlock.setPlacedBy` then reads the item's data and, when it contains a `RecordItem`, sets the block's `has_record` to true with flag 2. So a jukebox placed from an item that carries a disc holds the disc, its model draws it, and a click pops it out. Horizon got two things wrong on that path. `BlockEntity::for_block` had no `minecraft:jukebox` arm, so a placed jukebox got no block entity at all and the item's block entity data was dropped (a box only ever got one when a player put a disc in). And the `Block.setPlacedBy` dispatch in `Game::use_hand` had no jukebox arm, so even with a disc in the entity `has_record` stayed false: no disc model, and `useWithoutItem` would not hand the disc back. Changes: - `BlockEntity::for_block("minecraft:jukebox")` starts a placed box as an empty jukebox entity, as `JukeboxBlock.newBlockEntity` does. - `Game::jukebox_placed` sets `has_record` through `set_has_record` (UPDATE_CLIENTS) when the item's data carries a `RecordItem`, as `JukeboxBlock.setPlacedBy` does, and the dispatch calls it after `apply_placed_item`. - the `JukeboxBlock.setPlacedBy` port map row now points at it. **Proven:** - `cargo test -q -p horizon-client-lib --lib a_jukebox_item_with_a_record` -> `1 passed; 0 failed; ... 1382 filtered out`. - `cargo test -q -p horizon-client-render --lib a_placed_jukebox` -> `1 passed; 0 failed; ... 1116 filtered out`. - `cargo clippy -q -p horizon-client-lib --lib`, `cargo clippy -q -p horizon-client-render --lib` and `cargo clippy -q -p horizon-client --lib` print nothing. - `rustfmt --edition 2024 --check` on the four touched files is clean. **Not proven:** the game itself was not run. In-game check: in Creative, Ctrl+pick a jukebox that holds a disc, then place it; the box holds the disc, its model shows it, and a right click pops it out. A plain jukebox still places empty with no disc model. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:35:11 +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#7167
No description provided.