pumpkin-plugin-wit/v0.1/recipe.wit
Alexander Medvedev 54f158f102 some addtions
2026-08-16 22:16:49 +02:00

89 lines
2.7 KiB
Plaintext

interface recipe {
use item-stack.{item-stack};
/// Recipe category for the recipe book.
enum recipe-category {
building,
redstone,
equipment,
misc,
food,
blocks,
}
/// Represents an ingredient in a recipe.
variant ingredient {
/// A specific item (e.g. "minecraft:diamond").
item(string),
/// A tag group of items (e.g., "minecraft:logs").
tag(string),
/// One of multiple specific items.
one-of(list<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>,
/// The recipe category in the recipe book.
category: option<recipe-category>,
/// Whether to show a toast notification when the recipe is unlocked.
show-notification: option<bool>,
}
/// 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>,
/// The recipe category in the recipe book.
category: option<recipe-category>,
}
/// 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>,
/// The recipe category in the recipe book.
category: option<recipe-category>,
}
/// 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);
}
}