[GH-ISSUE #5929] Native mods: send a server's recipes to its Horizon clients (OnDatapackSyncEvent.sendRecipes, RecipesReceivedEvent) #1887

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

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

Originally assigned to: @Sylviromi on GitHub.

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

What a mod cannot do. A client mod that shows recipes (a recipe viewer, a machine GUI listing what it makes, a guide book) cannot see the recipes the server actually runs. native_recipes and native_recipes_of_type read the window's own tables, which are the content root alone: vanilla plus content mods. The docs of native_recipes_of_type say so: the single-player window sees only content mods' recipes, not the world's data packs'. So a client-side viewer misses every data-pack recipe and change, recipe filters (#5910), mod-contributed data pack files (#5581) and anything else the server changed, in single player as well as on a server. Vanilla 26.x does not help: it sends clients only the property sets and the stonecutter recipes.

Why the existing hooks do not reach it. The recipe helpers on the client read the local tables, and nothing puts the server's set there. #5582 (hear that the server loaded or reloaded its data) is server-side and only says that the data changed; it carries no recipes to the client. The server-side recipe helpers see the right set, but only on the server.

Proposed hooks. As NeoForge does (OnDatapackSyncEvent.sendRecipes and RecipesReceivedEvent):

  • native_datapack_sync, server, not cancellable. Fires when the sync data is built (server start and every /reload). The mod pushes the recipe type ids its clients need (minecraft:smelting, a mod's own type).
  • The server then sends the final recipes of those types (packs merged, load conditions and filters applied) to Horizon clients only, on a Horizon channel, in payloads within the 1 MiB clientbound cap, after the vanilla recipe update. The last payload marks the end. Vanilla clients see no change.
  • On the end marker the client's tables take those types in place of their own, so native_recipes and native_recipes_of_type return the server's set.
  • native_recipes_received, client, not cancellable. Fires once the synced recipes have arrived, with the type ids. A viewer rebuilds its index here.

Opt-in by type: no mod asking means nothing is sent, so joins stay vanilla-sized and nothing changes for anyone who does not use it. Side: both. The contract freezes at merge; the API number is given at merge.

Who already wants it. Recipe viewers and any client mod that shows recipes; machine GUIs that show their own recipes; guide books; client-side recipe lookups that must match the server. Related but insufficient: #5582 (server-side reload notice), #5910 (recipe filters, which is exactly the kind of server change a client cannot see today).

Workaround. A mod can read the server's recipes with the server-side helpers and send them to its client half through its own messages, then keep its own copy. Every mod has to redo the chunking under the payload cap and the rebuild on /reload, and the window's native_recipes still returns the content root, so other mods and the game's own lookups stay out of step with the server.

Originally created by @Sylviromi on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5929 Originally assigned to: @Sylviromi on GitHub. > 🤖 Filed by Sylviromi's AI agent (Claude Code, Sonnet 5.5), not by Sylviromi personally. **What a mod cannot do.** A client mod that shows recipes (a recipe viewer, a machine GUI listing what it makes, a guide book) cannot see the recipes the server actually runs. `native_recipes` and `native_recipes_of_type` read the window's own tables, which are the content root alone: vanilla plus content mods. The docs of `native_recipes_of_type` say so: the single-player window sees only content mods' recipes, not the world's data packs'. So a client-side viewer misses every data-pack recipe and change, recipe filters (#5910), mod-contributed data pack files (#5581) and anything else the server changed, in single player as well as on a server. Vanilla 26.x does not help: it sends clients only the property sets and the stonecutter recipes. **Why the existing hooks do not reach it.** The recipe helpers on the client read the local tables, and nothing puts the server's set there. #5582 (hear that the server loaded or reloaded its data) is server-side and only says that the data changed; it carries no recipes to the client. The server-side recipe helpers see the right set, but only on the server. **Proposed hooks.** As NeoForge does (`OnDatapackSyncEvent.sendRecipes` and `RecipesReceivedEvent`): - `native_datapack_sync`, server, not cancellable. Fires when the sync data is built (server start and every `/reload`). The mod pushes the recipe type ids its clients need (`minecraft:smelting`, a mod's own type). - The server then sends the final recipes of those types (packs merged, load conditions and filters applied) to Horizon clients only, on a Horizon channel, in payloads within the 1 MiB clientbound cap, after the vanilla recipe update. The last payload marks the end. Vanilla clients see no change. - On the end marker the client's tables take those types in place of their own, so `native_recipes` and `native_recipes_of_type` return the server's set. - `native_recipes_received`, client, not cancellable. Fires once the synced recipes have arrived, with the type ids. A viewer rebuilds its index here. Opt-in by type: no mod asking means nothing is sent, so joins stay vanilla-sized and nothing changes for anyone who does not use it. Side: both. The contract freezes at merge; the API number is given at merge. **Who already wants it.** Recipe viewers and any client mod that shows recipes; machine GUIs that show their own recipes; guide books; client-side recipe lookups that must match the server. Related but insufficient: #5582 (server-side reload notice), #5910 (recipe filters, which is exactly the kind of server change a client cannot see today). **Workaround.** A mod can read the server's recipes with the server-side helpers and send them to its client half through its own messages, then keep its own copy. Every mod has to redo the chunking under the payload cap and the rebuild on `/reload`, and the window's `native_recipes` still returns the content root, so other mods and the game's own lookups stay out of step with the server.
Author
Owner

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

🤖 Agent: /claim

<!-- gh-comment-id:6558081292 --> @Sylviromi commented on GitHub (Nov 1, 2026): 🤖 Agent: /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#1887
No description provided.