Skip to main content

RecipeRule

Enum RecipeRule 

#[non_exhaustive]
pub enum RecipeRule {
Show 15 variants Stonecutting { input: Ingredient, result: ItemStack, }, SmithingTransform { template: Option<Ingredient>, base: Ingredient, addition: Option<Ingredient>, result: RecipeTemplate, }, SmithingTrim { template: Ingredient, base: Ingredient, addition: Ingredient, pattern: RecipeTrimPattern, }, BannerDuplicate { banner: Ingredient, result: RecipeTemplate, }, ShieldDecoration { banner: Ingredient, target: Ingredient, result: RecipeTemplate, }, Transmute { input: Ingredient, material: Ingredient, min: usize, max: usize, add_count: bool, result: RecipeTemplate, }, Dye { target: Ingredient, dye: Ingredient, result: RecipeTemplate, }, Imbue { source: Ingredient, material: Ingredient, result: RecipeTemplate, }, BookCloning { source: Ingredient, material: Ingredient, min: i32, max: i32, result: RecipeTemplate, }, FireworkRocket { shell: Ingredient, fuel: Ingredient, star: Ingredient, result: RecipeTemplate, }, FireworkStar { dye: Ingredient, fuel: Ingredient, trail: Ingredient, twinkle: Ingredient, shapes: Vec<FireworkShapeIngredient>, result: RecipeTemplate, }, FireworkStarFade { dye: Ingredient, target: Ingredient, result: RecipeTemplate, }, MapExtending { map: Ingredient, material: Ingredient, result: RecipeTemplate, }, DecoratedPot { back: Ingredient, left: Ingredient, right: Ingredient, front: Ingredient, result: RecipeTemplate, }, RepairItem,
}
Expand description

The parsed rule of a stonecutting, smithing or special crafting recipe. These are the same resolved ingredients and rules the game uses, not a second recipe implementation. Only Stonecutting has a fixed output; every other variant depends on the grid or smithing inputs (components, counts, dyes, trim material, damage or map state). Special crafting results are assembled by crate::LevelRef::recipe_for, not by treating the template as a fixed stack. A mod-defined recipe type keeps its raw JSON instead of inventing a vanilla rule.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Stonecutting

A stonecutter input and fixed result.

Fields

§input: Ingredient

Accepted input.

§result: ItemStack

Exact output stack.

§

SmithingTransform

Apply a result template over the base item and its components.

Fields

§template: Option<Ingredient>

Optional template slot; absent requires an empty slot.

§base: Ingredient

Base slot; supplies the output components.

§addition: Option<Ingredient>

Optional addition slot; absent requires an empty slot.

§result: RecipeTemplate

Result template applied to inherited components.

§

SmithingTrim

Apply the pattern using the addition’s trim material to the base.

Fields

§template: Ingredient

Template slot.

§base: Ingredient

Base slot; supplies the output item and components.

§addition: Ingredient

Addition slot; selects the trim material.

§pattern: RecipeTrimPattern

Registry reference or inline trim pattern.

§

BannerDuplicate

Copy a patterned banner onto a blank banner of the same colour.

Fields

§banner: Ingredient

Banner ingredient.

§result: RecipeTemplate

Result template; patterns come from the grid.

§

ShieldDecoration

Apply a banner’s patterns to an undecorated shield.

Fields

§banner: Ingredient

Banner supplying patterns and colour.

§target: Ingredient

Shield to decorate.

§result: RecipeTemplate

Result template; components come from the grid.

§

Transmute

One input and a bounded number of materials, retaining input components.

Fields

§input: Ingredient

Input supplying the inherited item and components.

§material: Ingredient

Material ingredient.

§min: usize

Minimum number of occupied material slots.

§max: usize

Maximum number of occupied material slots.

§add_count: bool

Add the number of materials to the template’s result count.

§result: RecipeTemplate

Patch applied after the input’s components.

§

Dye

Dye a target using the grid’s dye colours.

Fields

§target: Ingredient

Target item.

§dye: Ingredient

Dye items.

§result: RecipeTemplate

Template; the resulting colour depends on the grid.

§

Imbue

Imbue materials with the source’s potion contents.

Fields

§source: Ingredient

Source of potion contents.

§material: Ingredient

Material around the source.

§result: RecipeTemplate

Template receiving the potion contents.

§

BookCloning

Copy a written book within the allowed generation range.

Fields

§source: Ingredient

Written book supplying contents and generation.

§material: Ingredient

Blank books.

§min: i32

Minimum allowed source generation.

§max: i32

Maximum allowed source generation.

§result: RecipeTemplate

Template; count and book contents depend on the grid.

§

FireworkRocket

Build rockets with flight duration and explosions from the grid.

Fields

§shell: Ingredient

Rocket shell.

§fuel: Ingredient

Fuel, whose occupied slots choose flight duration.

§star: Ingredient

Optional stars supplying explosions.

§result: RecipeTemplate

Rocket template.

§

FireworkStar

Build a star with colours, shape and effects from the grid.

Fields

§dye: Ingredient

Colour ingredients.

§fuel: Ingredient

Fuel ingredient.

§trail: Ingredient

Optional trail ingredient.

§twinkle: Ingredient

Optional twinkle ingredient.

§shapes: Vec<FireworkShapeIngredient>

Shape ingredients, in the parsed rule’s order.

§result: RecipeTemplate

Star template.

§

FireworkStarFade

Add fade colours to an existing star.

Fields

§dye: Ingredient

Fade colour ingredients.

§target: Ingredient

Star whose other explosion properties are retained.

§result: RecipeTemplate

Star template.

§

MapExtending

Extend a map when its live map state permits it.

Fields

§map: Ingredient

Map input.

§material: Ingredient

Surrounding material.

§result: RecipeTemplate

Template; map identity and postprocessing depend on the input.

§

DecoratedPot

Build a pot with decorations from the four sides of the grid.

Fields

§back: Ingredient

Back decoration.

§left: Ingredient

Left decoration.

§right: Ingredient

Right decoration.

§front: Ingredient

Front decoration.

§result: RecipeTemplate

Pot template.

§

RepairItem

Repair two damaged items of the same kind; eligibility, damage and retained curses depend on the input stacks, not a fixed ingredient list.

Trait Implementations§

§

impl Clone for RecipeRule

§

fn clone(&self) -> RecipeRule

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for RecipeRule

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Wire for RecipeRule

§

const MIN: usize = 4usize

Minimum encoded size, used to reject impossible collection lengths.
§

fn put(&self, out: &mut Writer)

Encodes this value, recording failures on the writer.
§

fn put_owned(self, out: &mut Writer)

Consumes owned data when a resource’s ownership must cross the boundary.
§

fn take(input: &mut Reader<'_>) -> Result<RecipeRule, WireError>

Decodes one value, leaving any following bytes for the caller.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Put for T
where T: Wire,

§

fn put_to(&self, out: &mut Writer)

Writes it.
§

impl<T> Record for T
where T: Wire,

§

fn encode(&self, out: &mut Writer)

Writes the argument into a hook call.
§

fn apply(&mut self, bytes: &[u8]) -> Result<(), WireError>

Applies one complete reply, refusing malformed or trailing bytes atomically.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.