Register create:compacting recipes for juices

This commit is contained in:
2026-10-30 23:22:57 -03:00
parent 43aa6b2551
commit 3734f5707a
2 changed files with 37 additions and 1 deletions
+17 -1
View File
@@ -3,7 +3,8 @@
// juicing recipes: what the juicer presses an item into. the shared script registers one for every item with
// bworld:juiceable, its own juice, and mods can add more like any recipe, as files or from their shared scripts.
// whatever makes juice reads them, like the juicer and create's press over a basin
// whatever makes juice reads them, like the juicer. with create installed, each is also a create:compacting recipe,
// so its press can make juice in a basin
import type { FluidVariant, SharedContext, TagApi } from "bworld/shared";
import type { JuiceableParams } from "./shared.ts";
@@ -24,6 +25,21 @@ export function register_juicing(ctx: SharedContext) {
const juice = { fluid: { id: "bworld:juice", data: { item: id } }, amount: params.juice };
ctx.recipes.register(JUICING, { input: id, fluid_results: [juice] });
}
if (ctx.blocks.exists("create:mechanical_press") && ctx.blocks.exists("create:basin")) {
register_compacting(ctx);
}
}
// a create:compacting recipe for every juicing recipe there is so far, so create's press squashes the item into its
// juice in a basin under it. create's recipes take a list of item choices and give a list of results, a fluid's as
// { fluid, amount }. juicing recipes other mods' shared scripts register later aren't seen here
function register_compacting(ctx: SharedContext) {
for (const juicing of ctx.recipes.list(JUICING)) {
ctx.recipes.register("create:compacting", {
ingredients: [juicing.input],
results: juicing.fluid_results,
});
}
}
// what reading them needs, which server scripts have