Add cooking pot from farmer's delight !

This commit is contained in:
2026-09-27 01:08:50 -03:00
parent 52587aabf7
commit e4c9a2f7f4
43 changed files with 913 additions and 10 deletions
+24 -2
View File
@@ -92,7 +92,20 @@ export type RecipeJson =
material: { id: string; count: number };
addition?: string;
result: string;
};
}
// a mod's own recipe type, like "farmersdelight:cooking" for its cooking pot. the engine only stores these, the mod's
// server script reads them with ctx.recipes.list and checks the rest
| ModRecipeJson;
export interface ModRecipeJson {
type: `${string}:${string}`;
[field: string]: unknown;
}
// a recipe type a mod made up, as opposed to the engine's shaped, furnace, fuel and smithing
export function is_mod_recipe(recipe: RecipeJson): recipe is ModRecipeJson {
return recipe.type.includes(":");
}
// the crafting grid's format, see server/game/crafting.ts
export interface GridRecipe {
@@ -417,6 +430,9 @@ export function validate_model(json: unknown): Problems {
if (face.uv !== undefined && (!Array.isArray(face.uv) || face.uv.length !== 4)) {
problems.push(`${where}.faces.${side}.uv must be [u1, v1, u2, v2] in pixels`);
}
if (face.rotation !== undefined && ![0, 90, 180, 270].includes(face.rotation as number)) {
problems.push(`${where}.faces.${side}.rotation must be 0, 90, 180 or 270`);
}
if (face.cullface !== undefined && !MODEL_FACES.includes(face.cullface as ModelFace)) {
problems.push(`${where}.faces.${side}.cullface isn't one of ${MODEL_FACES.join(", ")}`);
}
@@ -505,7 +521,13 @@ export function validate_recipe(json: unknown): Problems {
if (json.addition !== undefined) problems.push(...validate_id(json.addition, "addition"));
break;
default:
problems.push('type must be "shaped", "furnace", "fuel" or "smithing"');
if (typeof json.type !== "string" || !json.type.includes(":")) {
problems.push(
'type must be "shaped", "furnace", "fuel", "smithing" or a mod\'s own type like "farmersdelight:cooking"',
);
} else {
problems.push(...validate_id(json.type, "type"));
}
}
return problems;
}