pub struct Recipe {
pub id: String,
pub kind: RecipeKind,
pub result: String,
pub count: u32,
pub group: Option<String>,
pub category: Option<String>,
}Expand description
A recipe, in Yog’s own format — what a .yrecipe says. The host writes
the recipe JSON of its Minecraft version from it.
An ingredient is an item id (minecraft:stick), an item tag (#c:dusts)
or — the _any builders — any of several.
Recipe::shaped("yog:ruby_sword", "yog:ruby_sword", 1)
.row(" R ").row(" R ").row(" S ")
.key('R', "yog:ruby").key('S', "minecraft:stick");
Recipe::cooking("yog:ruby", Cooking::Blasting, "#c:ruby_ores", "yog:ruby", 1).experience(0.7);Fields§
§id: String§kind: RecipeKind§result: String§count: u32§group: Option<String>Recipes of a group share a slot in the recipe book.
category: Option<String>The recipe book’s tab (building, equipment, misc, …).
Implementations§
Source§impl Recipe
impl Recipe
pub fn shaped( id: impl Into<String>, result: impl Into<String>, count: u32, ) -> Recipe
pub fn shapeless( id: impl Into<String>, result: impl Into<String>, count: u32, ) -> Recipe
Sourcepub fn cooking(
id: impl Into<String>,
method: Cooking,
ingredient: impl Into<String>,
result: impl Into<String>,
count: u32,
) -> Recipe
pub fn cooking( id: impl Into<String>, method: Cooking, ingredient: impl Into<String>, result: impl Into<String>, count: u32, ) -> Recipe
Cooking ingredient (100 % of a vanilla furnace: 0.1 experience,
200 ticks — see Self::experience, Self::cook_time).
pub fn stonecutting( id: impl Into<String>, ingredient: impl Into<String>, result: impl Into<String>, count: u32, ) -> Recipe
pub fn smithing( id: impl Into<String>, template: impl Into<String>, base: impl Into<String>, addition: impl Into<String>, result: impl Into<String>, ) -> Recipe
Sourcepub fn key(self, symbol: char, item: impl Into<String>) -> Recipe
pub fn key(self, symbol: char, item: impl Into<String>) -> Recipe
What symbol stands for in a shaped recipe.
Sourcepub fn key_any(
self,
symbol: char,
items: impl IntoIterator<Item = impl Into<String>>,
) -> Recipe
pub fn key_any( self, symbol: char, items: impl IntoIterator<Item = impl Into<String>>, ) -> Recipe
symbol stands for any of items.
Sourcepub fn ingredient(self, item: impl Into<String>) -> Recipe
pub fn ingredient(self, item: impl Into<String>) -> Recipe
One more ingredient of a shapeless recipe.
Sourcepub fn ingredient_any(
self,
items: impl IntoIterator<Item = impl Into<String>>,
) -> Recipe
pub fn ingredient_any( self, items: impl IntoIterator<Item = impl Into<String>>, ) -> Recipe
One more ingredient of a shapeless recipe: any of items.
Sourcepub fn experience(self, xp: f32) -> Recipe
pub fn experience(self, xp: f32) -> Recipe
Experience a cooking recipe gives.
pub fn group(self, group: impl Into<String>) -> Recipe
pub fn category(self, category: impl Into<String>) -> Recipe
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Recipe
impl<'de> Deserialize<'de> for Recipe
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Recipe, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Recipe, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Recipe
impl Serialize for Recipe
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Recipe
Auto Trait Implementations§
impl Freeze for Recipe
impl RefUnwindSafe for Recipe
impl Send for Recipe
impl Sync for Recipe
impl Unpin for Recipe
impl UnsafeUnpin for Recipe
impl UnwindSafe for Recipe
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.