68 lines
2.0 KiB
Plaintext
68 lines
2.0 KiB
Plaintext
interface recipe {
|
|
use item-stack.{item-stack};
|
|
|
|
/// Represents an ingredient in a recipe.
|
|
variant ingredient {
|
|
/// A specific item.
|
|
item(string),
|
|
/// A tag group of items (e.g., "minecraft:logs").
|
|
tag(string),
|
|
}
|
|
|
|
/// Represents a shaped crafting recipe.
|
|
record shaped-recipe {
|
|
/// The pattern of the recipe (e.g., ["# #", " s ", "# #"]).
|
|
pattern: list<string>,
|
|
/// Mapping of characters in the pattern to ingredients.
|
|
key: list<tuple<string, ingredient>>,
|
|
/// The resulting item stack.
|
|
output: item-stack,
|
|
/// The recipe group (optional).
|
|
group: option<string>,
|
|
}
|
|
|
|
/// Represents a shapeless crafting recipe.
|
|
record shapeless-recipe {
|
|
/// The list of ingredients required.
|
|
ingredients: list<ingredient>,
|
|
/// The resulting item stack.
|
|
output: item-stack,
|
|
/// The recipe group (optional).
|
|
group: option<string>,
|
|
}
|
|
|
|
/// Represents a cooking recipe (Smelting, Blasting, Smoking, Campfire).
|
|
record cooking-recipe {
|
|
/// The ingredient to cook.
|
|
ingredient: ingredient,
|
|
/// The resulting item stack.
|
|
output: item-stack,
|
|
/// Experience points awarded.
|
|
experience: f32,
|
|
/// Cooking time in ticks.
|
|
cooking-time: u32,
|
|
/// The recipe group (optional).
|
|
group: option<string>,
|
|
}
|
|
|
|
/// Types of cooking stations.
|
|
enum cooking-type {
|
|
smelting,
|
|
blasting,
|
|
smoking,
|
|
campfire,
|
|
}
|
|
|
|
/// Common interface for registering recipes.
|
|
resource recipe-manager {
|
|
/// Registers a shaped crafting recipe.
|
|
register-shaped: func(id: string, recipe: shaped-recipe);
|
|
|
|
/// Registers a shapeless crafting recipe.
|
|
register-shapeless: func(id: string, recipe: shapeless-recipe);
|
|
|
|
/// Registers a cooking recipe.
|
|
register-cooking: func(id: string, station-type: cooking-type, recipe: cooking-recipe);
|
|
}
|
|
}
|