Better recipe api and port smithing to it

This commit is contained in:
2026-11-01 19:21:40 -03:00
parent ad782839ec
commit c8b5f2a3bd
50 changed files with 371 additions and 120 deletions
+3 -3
View File
@@ -12,6 +12,7 @@ import type {
ItemStack,
ModInfo,
Position,
RecipeLookup,
Season,
TagApi,
} from "./shared.ts";
@@ -641,13 +642,12 @@ export interface ServerFluidApi extends FluidApi {
interact(player: Player, handler: FluidHandler): boolean;
}
export interface RecipeApi {
// find and all read the recipes of types shared scripts registered
export interface RecipeApi extends RecipeLookup {
furnace_result(input: Id): { output: ItemStack; cook_time: number } | undefined;
fuel_value(item: Id): number; // burn time in ticks, 0 if it isn't fuel
is_fuel(item: Id): boolean;
is_smeltable(item: Id): boolean;
// the smithing recipe for these items, whatever the material's count. addition is the optional third item
smithing(tool: Id, material: Id, addition?: Id): { result: Id; material_count: number } | undefined;
// every recipe of a mod's own type, like "bworld:cooking", as its json. copies, in load order
// deno-lint-ignore no-explicit-any
list(type: Id): any[];