pub struct RecipeDef {
pub serial_id: u32,
pub id: Option<String>,
pub requirements: Vec<RecipeRequirement>,
pub results: Vec<RecipeResult>,
pub gen_name: Option<String>,
pub script: Option<String>,
}Expand description
A single crafting recipe definition.
Represents one combi=start…combi=end block from a combinations*.inf
file.
§.inf structure
combi=start
id=recipe_name (optional string identifier)
req=item_id[,count[,stay]]
req=item_id[,count[,stay]]
gen=item_id[,count]
genname=override_name (optional result name override)
script=start
... script commands ...
script=end
combi=endFields§
§serial_id: u32Numeric serial ID assigned by the loader (1‑based, sequential).
id: Option<String>Optional string identifier (from id= field, e.g. "bendablebranch").
requirements: Vec<RecipeRequirement>Ingredients required by this recipe.
results: Vec<RecipeResult>Items produced by this recipe.
gen_name: Option<String>Optional override for the generated item’s display name.
script: Option<String>Optional script executed when the recipe is crafted.
Implementations§
Source§impl RecipeDef
impl RecipeDef
Sourcepub fn from_combi_fields(
serial_id: u32,
fields: &HashMap<String, Vec<String>>,
) -> Option<Self>
pub fn from_combi_fields( serial_id: u32, fields: &HashMap<String, Vec<String>>, ) -> Option<Self>
Construct a RecipeDef from the raw fields inside a combi
block (i.e. a Structured block content’s fields).
The serial_id should be supplied by the caller (sequential
counter across all combi blocks).
Unknown or unparseable fields are silently ignored; missing
required fields (gen) return None.
Sourcepub fn from_inf_fields(
serial_id: u32,
fields: &HashMap<String, Vec<String>>,
) -> Option<Self>
pub fn from_inf_fields( serial_id: u32, fields: &HashMap<String, Vec<String>>, ) -> Option<Self>
Construct a RecipeDef from the entry-level fields of a parsed
.inf entry that contains combi blocks.
This is useful when the caller has the outer InfEntry fields
(which are usually empty for combinations files) and wants to
pass in the script separately.
Prefer from_combi_fields when you
already have the structured combi block fields.
Sourcepub fn with_script(self, script: Option<String>) -> Self
pub fn with_script(self, script: Option<String>) -> Self
Attach a script to this recipe (builder-style).