RecipeLayers¶
Namespace Nfty.Core.Formats in assembly Nfty.Core.
Resolving a recipe's layerOrder to its ingredients, in one place.
Methods¶
ById(LoadedRecipe)¶
The recipe's ingredients by id; on a duplicate id the last one wins.
Parameters
recipe(LoadedRecipe) - The recipe.
Returns. The ingredients by id.
TryResolve(LoadedRecipe, List<LoadedIngredient>)¶
Resolves a recipe's layerOrder to its ingredients, in order. Never throws: a transiently invalid book (a duplicate ingredient id, or a layerOrder entry naming a removed ingredient) is a normal state for live callers, not a crash. Ids resolve duplicate-tolerantly (last one wins, as RecipeLayers.ById()), and an entry with no ingredient fails the whole recipe back as "unresolved". Deciding what makes a book legal is the validator's job.
Parameters
recipe(LoadedRecipe) - The recipe.layers(List<LoadedIngredient>) - The ingredients in layer order when this returns true; otherwise empty.
Returns. Whether every layerOrder entry named an ingredient.