Struct Ingredient
pub struct Ingredient {
pub items: HashSet<String>,
pub order: Vec<String>,
pub custom: Option<(String, BTreeMap<JavaString, Tag>)>,
pub children: Option<(Shape, Vec<Ingredient>)>,
}Expand description
A set of accepted items (expanded from an item, list or tag), and the
items in its HolderSet order (Ingredient.display’s TagSlotDisplay).
Fields§
§items: HashSet<String>The items it accepts, however the source shape named them.
order: Vec<String>The same items in HolderSet order (display).
custom: Option<(String, BTreeMap<JavaString, Tag>)>A mod’s own kind, for matching at craft time: the kind and its
NBT compound, as the load-time hook saw them (ingredient_test).
children: Option<(Shape, Vec<Ingredient>)>NeoForge’s shapes, with their children parsed: matching a concrete
stack asks each child its own test (a mod’s kind among them),
as on NeoForge — the flat list above only names items.
Implementations§
§impl Ingredient
impl Ingredient
pub fn item_keys(
&self,
host: &dyn Host,
) -> Result<Arc<[ItemKey]>, IngredientKeysError>
pub fn item_keys( &self, host: &dyn Host, ) -> Result<Arc<[ItemKey]>, IngredientKeysError>
Resolve exact membership once per load/reload for local matching in mod memory.
Plain item lists, expanded tags and standard shapes with no custom descendants
are component-independent. A custom/component predicate anywhere in the tree
returns NotEnumerable: the display item list is not an exact predicate (and
for differences containing custom predicates is not even necessarily a superset).
Such predicates remain mod-owned; this method never invokes a match-time hook.
One host call per ingredient at publication; never call this per tick or candidate.
pub fn of(items: Vec<String>) -> Ingredient
pub fn of(items: Vec<String>) -> Ingredient
The items of a list, in order.
pub fn test(&self, host: &dyn Host, stack: &ItemStack) -> bool
pub fn test(&self, host: &dyn Host, stack: &ItemStack) -> bool
Ingredient.test: whether stack fits: a stack the list names, and
for a mod’s own kind one the match-time hook accepts
(ICustomIngredient.test). The game answers with the loop context of
the side host runs on; a host without a game refuses every stack.
Trait Implementations§
§impl Clone for Ingredient
impl Clone for Ingredient
§fn clone(&self) -> Ingredient
fn clone(&self) -> Ingredient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more