[PR #4987] [CLOSED] Banners mark the filled maps clicked on them #5992

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4987
Author: @JustKarkat
Created: 10/31/2026
Status: ❌ Closed

Base: main ← Head: fix/banner-map-markers


📝 Commits (1)

  • 2666aff Banners mark the filled maps clicked on them

📊 Changes

3 files changed (+463 additions, -5 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+7 -0)
📝 crates/horizon-client/src/game/cartography.rs (+1 -0)
📝 crates/horizon-client/src/game/maps.rs (+455 -5)

📄 Description

🤖 Opened by JustKarkat's AI agent (ZCode), working through the Kira board claim of #4298.

Fixes #4298

What was wrong

MapItem.useOn on a banner block toggles the banner's marker in the map's saved data (MapItemSavedData.toggleBanner), and MapItemSavedData.checkBanners drops the marker again when the banner is renamed, re-dyed or broken. Horizon's filled maps did nothing on a banner click: no banner decoration type existed (DECORATION_TYPES had 24 entries, none of the 16 banner_<dye> ones), MapData::banners was a save/load passthrough that never produced a decoration, and no use path read a banner block entity.

What this does

  • MapItem.useOn: using a filled map (any map_id stack) on a block in minecraft:banners toggles the banner's marker — the same pos, dye and name takes it off, anything else marks it (a rename replaces the marker, as bannerMarkers's put does). FAIL (no swing) outside the map's bounds or at the 256 tracked-decoration limit; the toggle reads the banner's centre (pos + 0.5), the decoration's rotation is 180 → 8, and the Nether's calculateRotation spin applies at mark time.
  • The 16 dye decoration types (banner_white … banner_black, sprites map/decorations/<dye>_banner), all trackCount like vanilla.
  • MapBanner's saved tag keeps vanilla's codec shape: pos as three ints, color only when not white, name as a plain string. Loading marks every saved banner again with the constructor's null-level path (plain block pos, rotation 8, no limit) — the decorations vanish with the map's pixels no longer, and vanilla-saved banners entries read back.
  • The colour sweep's checkBanners per scanned column: a marker whose banner now reads differently loses the marker and its entry.
  • The static-decorations reconcile no longer wipes banner decorations each tick (holder/banner-sourced decorations stay, as addDecoration's keyed entries do).

Name components carry only as the plain strings CustomName decodes to; the packet's decoration name stays None (Horizon sends no decoration names yet).

Checking it

Checked against the 26.3 jar: MapItem.useOn, MapItemSavedData.toggleBanner/checkBanners/addDecoration, MapBanner (codec, getId, getDecoration), MapDecorationTypes (registry names, assets, trackCount), and ServerPlayerGameMode.useItemOn (the consuming-useOn ITEM_USED_ON_BLOCK trigger).

Tests: marker toggle on/off, rename-replace, the bounds refusal (62.5 fits, 63.5 does not), the 256 tracked limit, the save format round-trip and the load rebuild, the stale-marker sweep, dye parsing, and the sprite for each of the 16 dyes. Headless proof (offscreen client + horizon-ctl): a placed banner marked, unmarked and re-marked a held map; breaking the banner cleared the marker on the sweep; saves/<world>/data/minecraft/maps/1.dat carries the banners tag with pos [-22, 69, 6].

tools/pr_ready.py green (rustfmt, clippy, 1313 client tests, 487 python tests).


🔄 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/4987 **Author:** [@JustKarkat](https://github.com/JustKarkat) **Created:** 10/31/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/banner-map-markers` --- ### 📝 Commits (1) - [`2666aff`](https://github.com/horizon-rust/horizon/commit/2666aff5b2d14aae10c26f640c67dd6d8fd129fb) Banners mark the filled maps clicked on them ### 📊 Changes **3 files changed** (+463 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+7 -0) 📝 `crates/horizon-client/src/game/cartography.rs` (+1 -0) 📝 `crates/horizon-client/src/game/maps.rs` (+455 -5) </details> ### 📄 Description > 🤖 Opened by JustKarkat's AI agent (ZCode), working through the Kira board claim of #4298. Fixes #4298 ## What was wrong `MapItem.useOn` on a banner block toggles the banner's marker in the map's saved data (`MapItemSavedData.toggleBanner`), and `MapItemSavedData.checkBanners` drops the marker again when the banner is renamed, re-dyed or broken. Horizon's filled maps did nothing on a banner click: no banner decoration type existed (`DECORATION_TYPES` had 24 entries, none of the 16 `banner_<dye>` ones), `MapData::banners` was a save/load passthrough that never produced a decoration, and no use path read a banner block entity. ## What this does - `MapItem.useOn`: using a filled map (any `map_id` stack) on a block in `minecraft:banners` toggles the banner's marker — the same pos, dye and name takes it off, anything else marks it (a rename replaces the marker, as `bannerMarkers`'s put does). FAIL (no swing) outside the map's bounds or at the 256 tracked-decoration limit; the toggle reads the banner's centre (`pos + 0.5`), the decoration's rotation is 180 → 8, and the Nether's `calculateRotation` spin applies at mark time. - The 16 dye decoration types (`banner_white` … `banner_black`, sprites `map/decorations/<dye>_banner`), all `trackCount` like vanilla. - `MapBanner`'s saved tag keeps vanilla's codec shape: `pos` as three ints, `color` only when not white, `name` as a plain string. Loading marks every saved banner again with the constructor's null-level path (plain block pos, rotation 8, no limit) — the decorations vanish with the map's pixels no longer, and vanilla-saved `banners` entries read back. - The colour sweep's `checkBanners` per scanned column: a marker whose banner now reads differently loses the marker and its entry. - The static-decorations reconcile no longer wipes banner decorations each tick (`holder`/`banner`-sourced decorations stay, as `addDecoration`'s keyed entries do). Name components carry only as the plain strings `CustomName` decodes to; the packet's decoration name stays `None` (Horizon sends no decoration names yet). ## Checking it Checked against the 26.3 jar: `MapItem.useOn`, `MapItemSavedData.toggleBanner`/`checkBanners`/`addDecoration`, `MapBanner` (codec, `getId`, `getDecoration`), `MapDecorationTypes` (registry names, assets, `trackCount`), and `ServerPlayerGameMode.useItemOn` (the consuming-`useOn` `ITEM_USED_ON_BLOCK` trigger). Tests: marker toggle on/off, rename-replace, the bounds refusal (62.5 fits, 63.5 does not), the 256 tracked limit, the save format round-trip and the load rebuild, the stale-marker sweep, dye parsing, and the sprite for each of the 16 dyes. Headless proof (offscreen client + horizon-ctl): a placed banner marked, unmarked and re-marked a held map; breaking the banner cleared the marker on the sweep; `saves/<world>/data/minecraft/maps/1.dat` carries the `banners` tag with `pos` [-22, 69, 6]. `tools/pr_ready.py` green (rustfmt, clippy, 1313 client tests, 487 python tests). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:28 +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#5992
No description provided.