[GH-ISSUE #6269] Native mods: a mod's own icons on filled maps, MapDecorationType #2038

Closed
opened 2026-11-02 15:51:32 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @levzzz5154 on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6269

Originally assigned to: @levzzz5154 on GitHub.

🤖 Filed by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally.

Part of #4953 ("Map decorations").

A mod cannot put its own icons on a filled map. NeoForge gives mods a MapDecorationType registry entry (an asset id for the icon, whether it shows on an item frame, the map colour and track-count flags) that code adds to a map with MapItemSavedData.addDecoration; it is saved with the map, sent to clients in ClientboundMapItemDataPacket by the type's registry id, and MapRenderer draws it from the map decoration atlas.

How Horizon does it: game/maps.rs keeps each map's Decorations (a sprite from a fixed table of vanilla types, DECORATION_TYPES, a position in half map pixels, a rotation and a name), saves and syncs them, and draws them in map_vertices (held map and item frame) and draw_map_decorations (the cartography table's map, game/cartography.rs). A server's packet names its type by minecraft:map_decoration_type registry id.

Two ways in, with real alternatives:

  1. A client hook that adds decorations when a map is drawn. native_map_decorations(map, decorations) is asked each time a map is drawn (held, framed, on the cartography screen) with the map's id, centre, scale and dimension; a mod pushes NativeMapDecoration { sprite, x, y, rot, shown_on_frame }, and they are drawn after the vanilla ones with the same pose. The mod decides what to show from its own data (waypoints from its mod messages, a machine network, anything it keeps) and nothing is saved in the map. Small, needs no registry, and works with vanilla servers and with a server mod's own messages.
  2. Typed decorations in the map's data. A mod registers a decoration type (needs code-side registration with a network id, the "Code-side registration of blocks, items and block-entity types, with network IDs" item of #4953, since a packet names the type by registry id and a vanilla client has no entry for it), a server hook adds them to a map (addDecoration), and they are saved with the map, counted toward its limit and synced like the vanilla ones. This is NeoForge's full model, and a bigger series: registry, save format, packet, hook, renderer.

Recommendation: do 1 now as the first self-contained step, and 2 after code-side registration exists, with 1's draw path (the sprite from the atlas, the pose) reused by 2. This issue's PR is step 1. Client side only. API from a fragment.

Originally created by @levzzz5154 on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6269 Originally assigned to: @levzzz5154 on GitHub. > 🤖 Filed by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally. Part of #4953 ("Map decorations"). A mod cannot put its own icons on a filled map. NeoForge gives mods a `MapDecorationType` registry entry (an asset id for the icon, whether it shows on an item frame, the map colour and track-count flags) that code adds to a map with `MapItemSavedData.addDecoration`; it is saved with the map, sent to clients in `ClientboundMapItemDataPacket` by the type's registry id, and `MapRenderer` draws it from the map decoration atlas. How Horizon does it: `game/maps.rs` keeps each map's `Decoration`s (a sprite from a fixed table of vanilla types, `DECORATION_TYPES`, a position in half map pixels, a rotation and a name), saves and syncs them, and draws them in `map_vertices` (held map and item frame) and `draw_map_decorations` (the cartography table's map, `game/cartography.rs`). A server's packet names its type by `minecraft:map_decoration_type` registry id. Two ways in, with real alternatives: 1. **A client hook that adds decorations when a map is drawn.** `native_map_decorations(map, decorations)` is asked each time a map is drawn (held, framed, on the cartography screen) with the map's id, centre, scale and dimension; a mod pushes `NativeMapDecoration { sprite, x, y, rot, shown_on_frame }`, and they are drawn after the vanilla ones with the same pose. The mod decides what to show from its own data (waypoints from its mod messages, a machine network, anything it keeps) and nothing is saved in the map. Small, needs no registry, and works with vanilla servers and with a server mod's own messages. 2. **Typed decorations in the map's data.** A mod registers a decoration type (needs code-side registration with a network id, the "Code-side registration of blocks, items and block-entity types, with network IDs" item of #4953, since a packet names the type by registry id and a vanilla client has no entry for it), a server hook adds them to a map (`addDecoration`), and they are saved with the map, counted toward its limit and synced like the vanilla ones. This is NeoForge's full model, and a bigger series: registry, save format, packet, hook, renderer. Recommendation: do 1 now as the first self-contained step, and 2 after code-side registration exists, with 1's draw path (the sprite from the atlas, the pose) reused by 2. This issue's PR is step 1. Client side only. API from a fragment.
Author
Owner

@levzzz5154 commented on GitHub (Nov 1, 2026):

/claim

<!-- gh-comment-id:6562236392 --> @levzzz5154 commented on GitHub (Nov 1, 2026): /claim
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#2038
No description provided.