pub enum Ingredient {
Empty,
Item(ItemRef),
Tag(Identifier),
Choice(&'static [ItemRef]),
}Expand description
Represents what items can satisfy a recipe slot.
Matches Java’s Ingredient class.
Variants§
Empty
Matches nothing (empty slot required).
Item(ItemRef)
Matches a single specific item.
Tag(Identifier)
Matches any item in a tag.
Choice(&'static [ItemRef])
Matches any of the listed items (OR).
Implementations§
Source§impl Ingredient
impl Ingredient
Sourcepub fn test(&self, stack: &ItemStack) -> bool
pub fn test(&self, stack: &ItemStack) -> bool
Tests if the given item stack satisfies this ingredient.
Sourcepub fn get_items(&self) -> Vec<ItemRef> ⓘ
pub fn get_items(&self) -> Vec<ItemRef> ⓘ
Returns all items that could satisfy this ingredient (for recipe book display).
Sourcepub fn eq_ingredient(&self, other: &Self) -> bool
pub fn eq_ingredient(&self, other: &Self) -> bool
Compares two ingredients for equality (used for symmetry detection).
Trait Implementations§
Source§impl Clone for Ingredient
impl Clone for Ingredient
Source§fn clone(&self) -> Ingredient
fn clone(&self) -> Ingredient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Ingredient
impl RefUnwindSafe for Ingredient
impl Send for Ingredient
impl Sync for Ingredient
impl Unpin for Ingredient
impl UnsafeUnpin for Ingredient
impl UnwindSafe for Ingredient
Blanket Implementations§
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