Host calls
Recipes
The recipes the server has loaded, datapack ones included, as vanilla recipe JSON.
Generated by tools/gen_api_docs.py; do not edit by hand. See host calls
for how a call is made and how values are encoded. Each example shows the shape of a Wasm
request with its required fields; the values in it are illustrative.
| Call | What it does |
|---|---|
recipes | One page of the recipes the server has loaded, as vanilla recipe JSON keyed by id: the game's own and every one the world's enabled datapacks add, a datapack's replacing the game's of the same id. |
recipes_revision | The revision of the recipe set recipes pages through: 16 hex digits that change when a reload changes any recipe, and only then. |
recipes
fn recipes(offset: usize, limit: usize) -> crate::value::RecipePage
One page of the recipes the server has loaded, as vanilla recipe JSON keyed by id: the
game's own and every one the world's enabled datapacks add, a datapack's replacing the
game's of the same id. A pack's are its data/<namespace>/recipe/<path>.json files.
offset counts from 0 in id order; limit is capped at MAX_RECIPE_PAGE.
Since 1.21.2 the game sends a client none of this -- ClientboundUpdateRecipesPacket
carries property sets and stonecutter recipes, the recipe book only unlocked displays --
so this is how a plugin hands a client mod the whole set.
A datapack recipe is kept when its file is a JSON object whose type is one of the
game's recipe types; anything else is skipped, with a line in the log, at load. The set is
read again by every /reload and /datapack enable|disable, and its revision changes
when what it holds does.
Wasm request
| Field | Type | Required |
|---|---|---|
offset | whole number, 0 or more | yes |
limit | whole number, 0 or more | yes |
Reply: {"ok": ...} holding the Rust return value crate::value::RecipePage, encoded as in conventions; objects in it carry revision, total, recipes.
{"call": "recipes", "offset": 0, "limit": 100}
recipes_revision
fn recipes_revision() -> String
The revision of the recipe set recipes pages through: 16 hex digits that change
when a reload changes any recipe, and only then. Cheap; a plugin polls it to notice a
reload. Empty on a host with no recipes.
Wasm request
No fields besides call.
Reply: {"ok": ...} holding the Rust return value String, encoded as in conventions.
{"call": "recipes_revision"}
From docs/api/reference/host-calls/recipes.md in the RustMC repository at bbd81209ad.