pub trait Recipe {
// Provided methods
fn shaped(&self) -> Vec<ShapedRecipe> { ... }
fn shapeless(&self) -> Vec<ShapelessRecipe> { ... }
fn cooking(&self) -> Vec<CookingRecipe> { ... }
fn has_recipes(&self) -> bool { ... }
fn register(&self) { ... }
}Expand description
A trait representing a collection of custom recipes that can be registered.
Types implementing this trait provide one or more recipes to be added to the
server when Recipe::register is called. All recipes are returned in
bulk to allow for efficient registration.
§Example
pub struct MyRecipes;
impl Recipe for MyRecipes {
fn recipes(&self) -> Vec<RecipeKind> {
vec![
RecipeKind::Shaped {
// ...
},
]
}
}Provided Methods§
Sourcefn shaped(&self) -> Vec<ShapedRecipe>
fn shaped(&self) -> Vec<ShapedRecipe>
Returns the shaped crafting recipes to be registered.
Each entry describes a recipe with a fixed grid pattern. Override this to provide shaped recipes. Defaults to an empty vector.
Sourcefn shapeless(&self) -> Vec<ShapelessRecipe>
fn shapeless(&self) -> Vec<ShapelessRecipe>
Returns the shapeless crafting recipes to be registered.
Each entry describes a recipe where ingredients can be placed in any slot of the crafting grid. Override this to provide shapeless recipes. Defaults to an empty vector.
Sourcefn cooking(&self) -> Vec<CookingRecipe>
fn cooking(&self) -> Vec<CookingRecipe>
Returns the cooking recipes to be registered.
Covers furnace, smoker, blast furnace, and campfire recipes. Override this to provide cooking recipes. Defaults to an empty vector.
Sourcefn has_recipes(&self) -> bool
fn has_recipes(&self) -> bool
Returns true if there is at least one recipe to register.