Pressing recipes

This commit is contained in:
2026-10-15 12:32:16 -03:00
parent 74c315bdfc
commit 7faa070d83
15 changed files with 335 additions and 35 deletions
+41
View File
@@ -531,6 +531,47 @@ Deno.test("tags keep their entries, renamed, and ones that don't exist here beco
assertStringIncludes(report.warnings[0].warning, "bworld:stone");
});
Deno.test("create's pressing recipes keep their shape, with bworld's item choices, from 0.5's and 6.0's json", () => {
const mod = gears_mod();
const report = import_recipes(
data({
// 0.5 named results' items "item", and an ingredient that's a list is one any of whose items fit
"gears/recipes/pressing/teeth": {
type: "create:pressing",
ingredients: [[{ tag: "gears:teeth" }, { item: "gears:gear" }]],
results: [{ item: "gears:gear", count: 2 }],
processingTime: 100,
},
"gears/recipe/pressing/gear": {
type: "create:pressing",
ingredients: [{ item: "gears:gear" }],
results: [{ id: "gears:gear" }, { id: "gears:gear", chance: 0.5 }, { id: "gears:gear", chance: 1 }],
},
"gears/recipe/pressing/granite": {
type: "create:pressing",
ingredients: [{ item: "minecraft:granite" }],
results: [{ id: "gears:gear" }],
},
}),
{ output: `${mod}/recipes` },
);
assertEquals(report.errors, []);
const read = (path: string) => JSON.parse(Deno.readTextFileSync(`${mod}/recipes/${path}.json`)).recipe;
assertEquals(read("pressing/teeth"), {
type: "create:pressing",
ingredients: [["#gears:teeth", "gears:gear"]],
results: [{ id: "gears:gear", count: 2 }],
processing_time: 100,
});
// a chance is only kept when it isn't certain
assertEquals(read("pressing/gear").results, [
{ id: "gears:gear", count: 1 },
{ id: "gears:gear", count: 1, chance: 0.5 },
{ id: "gears:gear", count: 1 },
]);
assertEquals(report.skipped.map(({ location }) => location), ["gears:pressing/granite"]);
});
Deno.test("stonecutting recipes become bworld's, and ones it can't use are reported", () => {
const mod = gears_mod();
const cut = (ingredient: unknown, result: unknown, extra = {}) => ({