pub enum ToolPredicate {
Item(Identifier),
HasEnchantment {
enchantment: Identifier,
min_level: i32,
},
Tag(Identifier),
Any,
}Expand description
Predicate for matching tools.
Variants§
Item(Identifier)
Match a specific item.
HasEnchantment
Match items with a specific enchantment at minimum level.
Tag(Identifier)
Match items in a tag.
Any
Always matches (no predicate specified).
Implementations§
Source§impl ToolPredicate
impl ToolPredicate
Sourcepub fn test<R: Rng>(&self, tool: &ItemStack, _ctx: &LootContext<'_, R>) -> bool
pub fn test<R: Rng>(&self, tool: &ItemStack, _ctx: &LootContext<'_, R>) -> bool
Test if the tool matches this predicate.
Trait Implementations§
Source§impl Clone for ToolPredicate
impl Clone for ToolPredicate
Auto Trait Implementations§
impl Freeze for ToolPredicate
impl RefUnwindSafe for ToolPredicate
impl Send for ToolPredicate
impl Sync for ToolPredicate
impl Unpin for ToolPredicate
impl UnsafeUnpin for ToolPredicate
impl UnwindSafe for ToolPredicate
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>