[PR #3945] [MERGED] Map banner and frame markers #5309

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3945
Author: @kacpherek
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/split-maps-villager-trades


📝 Commits (10+)

  • f8eebef Draw the item a villager holds on its crossed arms
  • 834cc83 Sync a mob's main hand enchantments to its viewers
  • c8a6cf4 Let a villager brain ask the level to roll its offers
  • 4ce5d55 Empty a villager's hand when it stops showing trades
  • 837d409 Hold up the offer a villager sells for the item you hold
  • e743e4e Cycle the items a villager holds up every 40 ticks
  • 5430fa0 Route map markers through addDecoration with vanilla keys
  • a5b45de Load and save map banner and frame markers as vanilla does
  • e108d1d Read a placed banner as a map marker source
  • 955214a Toggle a banner's marker on a map

📊 Changes

9 files changed (+620 additions, -86 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+1 -0)
📝 crates/horizon-client/src/game/banners.rs (+33 -1)
📝 crates/horizon-client/src/game/cartography.rs (+6 -3)
📝 crates/horizon-client/src/game/commands.rs (+7 -1)
📝 crates/horizon-client/src/game/frames.rs (+6 -0)
📝 crates/horizon-client/src/game/maps.rs (+497 -80)
📝 crates/horizon-client/src/game/remote.rs (+12 -1)
📝 crates/horizon-client/src/game/stations.rs (+11 -0)
📝 crates/horizon-client/src/item_tooltip.rs (+47 -0)

📄 Description

What and why

  • Route map markers through addDecoration with vanilla keys: A map kept one marker per player and rebuilt the item ones, with no place for a banner or frame marker. MapItemSavedData.addDecoration files each MapDecoration under a key (player, banner, frame), keeps its place in the drawing order, clamps it to the map, swaps a player's arrow for the off-map ones and drops what falls outside (MapItemSavedData.java:253). Markers now carry their name and key, and the update packet sends the name.
  • Load and save map banner and frame markers as vanilla does: A map kept its banners and frames lists as raw tags, so the markers never showed. MapItemSavedData's constructor adds a banner marker in the banner's dye colour (MapBanner.getDecoration, the 16 banner decoration types) and a frame marker for each saved entry, without a level, and the lists are written back (MapBanner.CODEC, MapFrame.CODEC, MapItemSavedData.java:100). A locked copy keeps the banners and the decorations (MapItemSavedData.locked).
  • Read a placed banner as a map marker source: A map had no way to ask what banner stands at a position. MapBanner.fromWorld returns the banner block entity's base colour (the block's dye colour) and custom name, or nothing when no banner is there (MapBanner.java:25).
  • Toggle a banner's marker on a map: A map could not add or drop a banner marker on request. MapItemSavedData.toggleBanner works only for a banner inside the map: one whose marker stands as it is loses it, otherwise the marker is added (renewed when the banner changed) unless the map already tracks more than 256 markers (MapItemSavedData.java:371, MapDecorationType.trackCount).
  • Mark a banner on the map when the map is used on it: A map used on a placed banner did nothing. MapItem.useOn toggles that banner's marker through toggleBanner: SUCCESS swings and counts as a use, FAIL (the map refuses) ends the use quietly, and the item is never placed or used otherwise (MapItem.java:336).
  • Drop a map's banner marker when its banner is gone: A banner marker stayed on the map after its banner was broken or changed. MapItem.update calls MapItemSavedData.checkBanners for every column it reads: a marker in that column whose banner is no longer the saved one (colour, name or the banner itself) loses its decoration and its entry (MapItemSavedData.java:401).
  • Hide players in map invisibility gear from others' maps: A player wearing a carved pumpkin was still drawn on other players' maps. MapItemSavedData.tickCarriedBy removes the marker of every other holder for whom hasMapInvisibilityItemEquipped finds a piece of #map_invisibility_equipment in an armor slot (MapItemSavedData.java:225). Each holder keeps what it wore on its own tick.
  • Mark a framed map's item frame on the map: A map hanging in an item frame never showed the frame's marker, and a player who saw it framed without carrying it kept a marker. ServerEntity.sendChanges ticks every 10 ticks tickCarriedBy(player, stack, frame) for each player: one carrying no copy loses their marker, and with position tracking the frame's marker is added under its entity and the frame saved with its block, rotation (2D direction times 90) and entity, replacing an older entity's marker at the same block (MapItemSavedData.java:159).
  • Clear a map's frame marker when its item frame loses the map: Taking a map out of an item frame, breaking the frame, a blast or /kill left the frame's marker and saved entry on the map. ItemFrame.removeFramedMap calls MapItemSavedData.removedFromFrame(pos, entityId) on every path that empties the frame (dropItem unless the drops are off and something caused it, onKilled), which removes the marker and the frame entry (MapItemSavedData.java:421, ItemFrame.java:247).
  • List a map's id, lock and scale in its tooltip: A filled map's tooltip showed none of its lines. MapId.addToTooltip gives Unknown Map when the client has no data for it, else the id line (not for a named map or one a cartography table is locking or scaling), Locked, and with advanced tooltips the scale and level, a scaling copy counting one more up to 4 (MapId.java:27). The lines sit between the instrument and bees lines as in ItemStack.addDetailsToTooltipComponents.

Vanilla reference

Each commit message names the vanilla method and file it follows: MapItemSavedData.java:253, MapItemSavedData.java:100, MapBanner.java:25, MapItemSavedData.java:371, MapItem.java:336, MapItemSavedData.java:401, MapItemSavedData.java:225, MapItemSavedData.java:159, MapItemSavedData.java:421, ItemFrame.java:247, MapId.java:27

Self-check

Split out of #3926; the villager trade display moved to its own branch as the review asked. Merged with main; rustfmt on changed files; built by CI; not run in game. To check in game: put a map in an item frame and see the frame's marker on a map you carry; use a map on a banner and see the banner's marker appear, then break the banner and see it go; hover a filled map to see its id, Locked and (with F3+H) scale lines.

fixes #3515


🔄 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/3945 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/split-maps-villager-trades` --- ### 📝 Commits (10+) - [`f8eebef`](https://github.com/horizon-rust/horizon/commit/f8eebefe0a9de7fea854e654718bf638eabb949d) Draw the item a villager holds on its crossed arms - [`834cc83`](https://github.com/horizon-rust/horizon/commit/834cc83e856d8645365158bdd0e2078da4574347) Sync a mob's main hand enchantments to its viewers - [`c8a6cf4`](https://github.com/horizon-rust/horizon/commit/c8a6cf4364ad026db7b8d5277ad39a0e0046de59) Let a villager brain ask the level to roll its offers - [`4ce5d55`](https://github.com/horizon-rust/horizon/commit/4ce5d55664d48c7b19068342d77da4efebe75ea2) Empty a villager's hand when it stops showing trades - [`837d409`](https://github.com/horizon-rust/horizon/commit/837d409e313b4f4ee8cb2a214923690782fe4ffe) Hold up the offer a villager sells for the item you hold - [`e743e4e`](https://github.com/horizon-rust/horizon/commit/e743e4e418e0736830beb6938830add49cbc1a17) Cycle the items a villager holds up every 40 ticks - [`5430fa0`](https://github.com/horizon-rust/horizon/commit/5430fa0f6a7b31b8da15c416a73c4fce37e6fe11) Route map markers through addDecoration with vanilla keys - [`a5b45de`](https://github.com/horizon-rust/horizon/commit/a5b45dead570b395f4e2cb661833e1aaa22b7f7a) Load and save map banner and frame markers as vanilla does - [`e108d1d`](https://github.com/horizon-rust/horizon/commit/e108d1d57f74dd97ecbafbcd8b1bab3ca6b88c94) Read a placed banner as a map marker source - [`955214a`](https://github.com/horizon-rust/horizon/commit/955214ae1ba1f7410180d41486e82123927e0dbe) Toggle a banner's marker on a map ### 📊 Changes **9 files changed** (+620 additions, -86 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+1 -0) 📝 `crates/horizon-client/src/game/banners.rs` (+33 -1) 📝 `crates/horizon-client/src/game/cartography.rs` (+6 -3) 📝 `crates/horizon-client/src/game/commands.rs` (+7 -1) 📝 `crates/horizon-client/src/game/frames.rs` (+6 -0) 📝 `crates/horizon-client/src/game/maps.rs` (+497 -80) 📝 `crates/horizon-client/src/game/remote.rs` (+12 -1) 📝 `crates/horizon-client/src/game/stations.rs` (+11 -0) 📝 `crates/horizon-client/src/item_tooltip.rs` (+47 -0) </details> ### 📄 Description ## What and why - Route map markers through addDecoration with vanilla keys: A map kept one marker per player and rebuilt the item ones, with no place for a banner or frame marker. MapItemSavedData.addDecoration files each MapDecoration under a key (player, banner, frame), keeps its place in the drawing order, clamps it to the map, swaps a player's arrow for the off-map ones and drops what falls outside (MapItemSavedData.java:253). Markers now carry their name and key, and the update packet sends the name. - Load and save map banner and frame markers as vanilla does: A map kept its banners and frames lists as raw tags, so the markers never showed. MapItemSavedData's constructor adds a banner marker in the banner's dye colour (MapBanner.getDecoration, the 16 banner decoration types) and a frame marker for each saved entry, without a level, and the lists are written back (MapBanner.CODEC, MapFrame.CODEC, MapItemSavedData.java:100). A locked copy keeps the banners and the decorations (MapItemSavedData.locked). - Read a placed banner as a map marker source: A map had no way to ask what banner stands at a position. MapBanner.fromWorld returns the banner block entity's base colour (the block's dye colour) and custom name, or nothing when no banner is there (MapBanner.java:25). - Toggle a banner's marker on a map: A map could not add or drop a banner marker on request. MapItemSavedData.toggleBanner works only for a banner inside the map: one whose marker stands as it is loses it, otherwise the marker is added (renewed when the banner changed) unless the map already tracks more than 256 markers (MapItemSavedData.java:371, MapDecorationType.trackCount). - Mark a banner on the map when the map is used on it: A map used on a placed banner did nothing. MapItem.useOn toggles that banner's marker through toggleBanner: SUCCESS swings and counts as a use, FAIL (the map refuses) ends the use quietly, and the item is never placed or used otherwise (MapItem.java:336). - Drop a map's banner marker when its banner is gone: A banner marker stayed on the map after its banner was broken or changed. MapItem.update calls MapItemSavedData.checkBanners for every column it reads: a marker in that column whose banner is no longer the saved one (colour, name or the banner itself) loses its decoration and its entry (MapItemSavedData.java:401). - Hide players in map invisibility gear from others' maps: A player wearing a carved pumpkin was still drawn on other players' maps. MapItemSavedData.tickCarriedBy removes the marker of every other holder for whom hasMapInvisibilityItemEquipped finds a piece of #map_invisibility_equipment in an armor slot (MapItemSavedData.java:225). Each holder keeps what it wore on its own tick. - Mark a framed map's item frame on the map: A map hanging in an item frame never showed the frame's marker, and a player who saw it framed without carrying it kept a marker. ServerEntity.sendChanges ticks every 10 ticks tickCarriedBy(player, stack, frame) for each player: one carrying no copy loses their marker, and with position tracking the frame's marker is added under its entity and the frame saved with its block, rotation (2D direction times 90) and entity, replacing an older entity's marker at the same block (MapItemSavedData.java:159). - Clear a map's frame marker when its item frame loses the map: Taking a map out of an item frame, breaking the frame, a blast or /kill left the frame's marker and saved entry on the map. ItemFrame.removeFramedMap calls MapItemSavedData.removedFromFrame(pos, entityId) on every path that empties the frame (dropItem unless the drops are off and something caused it, onKilled), which removes the marker and the frame entry (MapItemSavedData.java:421, ItemFrame.java:247). - List a map's id, lock and scale in its tooltip: A filled map's tooltip showed none of its lines. MapId.addToTooltip gives Unknown Map when the client has no data for it, else the id line (not for a named map or one a cartography table is locking or scaling), Locked, and with advanced tooltips the scale and level, a scaling copy counting one more up to 4 (MapId.java:27). The lines sit between the instrument and bees lines as in ItemStack.addDetailsToTooltipComponents. ## Vanilla reference Each commit message names the vanilla method and file it follows: MapItemSavedData.java:253, MapItemSavedData.java:100, MapBanner.java:25, MapItemSavedData.java:371, MapItem.java:336, MapItemSavedData.java:401, MapItemSavedData.java:225, MapItemSavedData.java:159, MapItemSavedData.java:421, ItemFrame.java:247, MapId.java:27 ## Self-check Split out of #3926; the villager trade display moved to its own branch as the review asked. Merged with main; rustfmt on changed files; built by CI; not run in game. To check in game: put a map in an item frame and see the frame's marker on a map you carry; use a map on a banner and see the banner's marker appear, then break the banner and see it go; hover a filled map to see its id, Locked and (with F3+H) scale lines. fixes #3515 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:11: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#5309
No description provided.