ctx.recipes.list api on shared side

This commit is contained in:
2026-10-30 23:17:54 -03:00
parent 4717e45a9a
commit 43aa6b2551
5 changed files with 41 additions and 3 deletions
+11
View File
@@ -187,6 +187,17 @@ like any other. That's also why it's only in shared scripts. Recipes can only be
server or client script sets up, and one is checked like a file would be: a broken one, or a second furnace recipe for
the same input, throws, which stops the mod loading.
`ctx.recipes.list(type?)` reads the recipes there are so far, copies in load order, like the client's: every mod's
`recipes/` files, and what the shared scripts that set up before this one registered. Dependencies set up first, so a
mod can make recipes of its own from another mod's, like a machine of its own for every one of the base game's juicing
recipes:
```ts
for (const juicing of ctx.recipes.list("bworld:juicing")) {
ctx.recipes.register("copper_tools:squeezing", { input: juicing.input, fluid_results: juicing.fluid_results });
}
```
Make them from what's the same on every side, like items and their components, not from the server's
[config](../misc/config.md), which clients don't have.