pub struct Enchantment {
pub key: Identifier,
pub max_level: u32,
pub min_cost: EnchantmentCost,
pub max_cost: EnchantmentCost,
pub anvil_cost: i32,
pub weight: u32,
pub slots: &'static [EquipmentSlotGroup],
pub supported_items: &'static str,
pub primary_items: Option<&'static str>,
pub exclusive_set: Option<&'static str>,
pub effects_nbt: fn() -> NbtCompound,
pub effects: EnchantmentEffects,
}Fields§
§key: Identifier§max_level: u32§min_cost: EnchantmentCost§max_cost: EnchantmentCost§anvil_cost: i32§weight: u32§slots: &'static [EquipmentSlotGroup]§supported_items: &'static str§primary_items: Option<&'static str>§exclusive_set: Option<&'static str>§effects_nbt: fn() -> NbtCompound§effects: EnchantmentEffectsImplementations§
Source§impl Enchantment
impl Enchantment
Sourcepub fn matching_slot(&self, slot: EquipmentSlot) -> bool
pub fn matching_slot(&self, slot: EquipmentSlot) -> bool
Vanilla Enchantment::matchingSlot.
Sourcepub fn can_enchant(&self, item: ItemRef) -> bool
pub fn can_enchant(&self, item: ItemRef) -> bool
Checks if this enchantment can be applied to the given item via supported_items tag.
Sourcepub fn are_compatible(a: EnchantmentRef, b: EnchantmentRef) -> bool
pub fn are_compatible(a: EnchantmentRef, b: EnchantmentRef) -> bool
Checks if two enchantments are compatible (neither’s exclusive_set contains the other).
Sourcepub fn is_compatible_with_existing(
enchantment: EnchantmentRef,
item: &ItemStack,
) -> bool
pub fn is_compatible_with_existing( enchantment: EnchantmentRef, item: &ItemStack, ) -> bool
Checks if this enchantment is compatible with all existing enchantments on an item.
Trait Implementations§
Source§impl Debug for Enchantment
impl Debug for Enchantment
impl Eq for Enchantment
Source§impl PartialEq for Enchantment
impl PartialEq for Enchantment
Source§impl RegistryEntry for Enchantment
impl RegistryEntry for Enchantment
Source§impl RegistryHolderSetEntry for Enchantment
impl RegistryHolderSetEntry for Enchantment
Source§const REGISTRY_NAME: &'static str = "enchantment"
const REGISTRY_NAME: &'static str = "enchantment"
Human-readable registry name used in codec errors.
Source§fn holder_set_by_id(id: usize) -> Option<&'static Self>
fn holder_set_by_id(id: usize) -> Option<&'static Self>
Looks up an entry by its protocol registry ID.
Source§fn holder_set_by_key(key: &Identifier) -> Option<&'static Self>
fn holder_set_by_key(key: &Identifier) -> Option<&'static Self>
Looks up an entry by its registry key.
Source§fn holder_set_tag_exists(tag: &Identifier) -> bool
fn holder_set_tag_exists(tag: &Identifier) -> bool
Returns whether the registry contains this tag.
Source§fn holder_set_tag_contains(entry: &'static Self, tag: &Identifier) -> bool
fn holder_set_tag_contains(entry: &'static Self, tag: &Identifier) -> bool
Returns whether an entry belongs to this tag.
Source§impl ToNbtTag for &Enchantment
impl ToNbtTag for &Enchantment
fn to_nbt_tag(self) -> NbtTag
fn to_optional_nbt_tag(self) -> Option<NbtTag>
Auto Trait Implementations§
impl Freeze for Enchantment
impl RefUnwindSafe for Enchantment
impl Send for Enchantment
impl Sync for Enchantment
impl Unpin for Enchantment
impl UnsafeUnpin for Enchantment
impl UnwindSafe for Enchantment
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§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<>>