[GH-ISSUE #6312] Native mods: data maps, RegisterDataMapTypesEvent #2048

Closed
opened 2026-11-02 15:51:37 +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/6312

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 ("Data maps and mod datapack registries (RegisterDataMapTypesEvent, DataPackRegistryEvent.NewRegistry)"). This issue is the data maps half; a mod's own datapack registry is the second step, in its own issue and PR once this lands.

A tech mod attaches values to registry entries as data a pack can change: a machine's fuel burn times per item, a block's hardness class, a recipe-less conversion table. Vanilla 26.3 has no data maps (its equivalents are hard-coded tables, or components), so the contract is NeoForge's DataMapType javadoc:

  • A mod registers a data map type (RegisterDataMapTypesEvent): an id and the registry it is for.
  • Files data/<map namespace>/data_maps/<registry namespace>/<registry path>/<map path>.json, the registry namespace left out for minecraft: {"replace": false, "values": {"minecraft:coal": {...}, "#minecraft:logs": {...}}, "remove": ["minecraft:carrot", "#minecraft:logs"]}. A value is the data itself or {"value": ..., "replace": false}. replace clears everything earlier packs set; remove applies after the file's own values; a tag gives every entry in it the value; a newer value overrides an older one for the same entry (NeoForge's default merger).
  • Holder.getData(type) / IWithData.getData(type) reads an entry's value.

Steps (a series):

  1. This issue, first PR: types for minecraft:item and minecraft:block; files from the world's data packs and from a mod's native_data_pack_files (key data_maps/<ns>:<registry path>/<map path>), merged per load (a world's first open and every /reload) with replace, remove and tags resolved against the loaded item and block tags; values are opaque JSON a mod reads back. Hook native_data_map_types (a mod pushes its types, asked once per load) and helper native_data_map(registry, type, entry). Server side.
  2. More registries (entity types, mob effects, fluids...), and mergers for list/set/map values (AdvancedDataMapType).
  3. Sync to Horizon clients (networkCodec), with the mandatory flag.
  4. Conditions (neoforge:conditions) in data map files.
  5. Mod datapack registries (DataPackRegistryEvent.NewRegistry): its own issue.

API from a fragment.

Originally created by @levzzz5154 on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6312 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 ("Data maps and mod datapack registries (`RegisterDataMapTypesEvent`, `DataPackRegistryEvent.NewRegistry`)"). This issue is the data maps half; a mod's own datapack registry is the second step, in its own issue and PR once this lands. A tech mod attaches values to registry entries as data a pack can change: a machine's fuel burn times per item, a block's hardness class, a recipe-less conversion table. Vanilla 26.3 has no data maps (its equivalents are hard-coded tables, or components), so the contract is NeoForge's `DataMapType` javadoc: - A mod registers a data map type (`RegisterDataMapTypesEvent`): an id and the registry it is for. - Files `data/<map namespace>/data_maps/<registry namespace>/<registry path>/<map path>.json`, the registry namespace left out for `minecraft`: `{"replace": false, "values": {"minecraft:coal": {...}, "#minecraft:logs": {...}}, "remove": ["minecraft:carrot", "#minecraft:logs"]}`. A value is the data itself or `{"value": ..., "replace": false}`. `replace` clears everything earlier packs set; `remove` applies after the file's own values; a tag gives every entry in it the value; a newer value overrides an older one for the same entry (NeoForge's default merger). - `Holder.getData(type)` / `IWithData.getData(type)` reads an entry's value. Steps (a series): 1. **This issue, first PR**: types for `minecraft:item` and `minecraft:block`; files from the world's data packs and from a mod's `native_data_pack_files` (key `data_maps/<ns>:<registry path>/<map path>`), merged per load (a world's first open and every `/reload`) with `replace`, `remove` and tags resolved against the loaded item and block tags; values are opaque JSON a mod reads back. Hook `native_data_map_types` (a mod pushes its types, asked once per load) and helper `native_data_map(registry, type, entry)`. Server side. 2. More registries (entity types, mob effects, fluids...), and mergers for list/set/map values (`AdvancedDataMapType`). 3. Sync to Horizon clients (`networkCodec`), with the mandatory flag. 4. Conditions (`neoforge:conditions`) in data map files. 5. Mod datapack registries (`DataPackRegistryEvent.NewRegistry`): its own issue. API from a fragment.
Author
Owner

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

/claim

<!-- gh-comment-id:6562497789 --> @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#2048
No description provided.