Struct ItemAttributeModifiers
pub struct ItemAttributeModifiers { /* private fields */ }Expand description
The attribute modifiers of one item stack, as item_attribute_modifier
edits them (ItemAttributeModifierEvent’s list). It starts as the
stack’s own minecraft:attribute_modifiers, or its item’s, in order.
Implementations§
§impl ItemAttributeModifiers
impl ItemAttributeModifiers
pub fn iter(&self) -> Iter<'_, ItemAttributeModifier> ⓘ
pub fn iter(&self) -> Iter<'_, ItemAttributeModifier> ⓘ
The modifiers, in order.
pub fn add(
&mut self,
attribute: Identifier,
modifier: AttributeModifier,
slot: EquipmentSlotGroup,
) -> bool
pub fn add( &mut self, attribute: Identifier, modifier: AttributeModifier, slot: EquipmentSlotGroup, ) -> bool
addModifier: adds modifier on attribute in the slots of slot,
unless attribute already has a modifier with its id. Whether it
was added.
pub fn replace(
&mut self,
attribute: Identifier,
modifier: AttributeModifier,
slot: EquipmentSlotGroup,
)
pub fn replace( &mut self, attribute: Identifier, modifier: AttributeModifier, slot: EquipmentSlotGroup, )
replaceModifier: puts modifier on attribute in the slots of
slot, in place of the one with its id, or at the end.
pub fn remove(&mut self, attribute: &Identifier, id: &Identifier) -> bool
pub fn remove(&mut self, attribute: &Identifier, id: &Identifier) -> bool
removeModifier: removes the modifier id of attribute. Whether
there was one.
pub fn retain(
&mut self,
keep: impl FnMut(&ItemAttributeModifier) -> bool,
) -> bool
pub fn retain( &mut self, keep: impl FnMut(&ItemAttributeModifier) -> bool, ) -> bool
removeIf: keeps only the modifiers keep accepts. Whether any went.
pub fn remove_all_for(&mut self, attribute: &Identifier) -> bool
pub fn remove_all_for(&mut self, attribute: &Identifier) -> bool
removeAllModifiersFor: removes every modifier of attribute.
Whether any went.
pub fn clear(&mut self)
pub fn clear(&mut self)
clearModifiers: removes every modifier.
Trait Implementations§
§impl Clone for ItemAttributeModifiers
impl Clone for ItemAttributeModifiers
§fn clone(&self) -> ItemAttributeModifiers
fn clone(&self) -> ItemAttributeModifiers
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 more§impl Debug for ItemAttributeModifiers
impl Debug for ItemAttributeModifiers
§impl Default for ItemAttributeModifiers
impl Default for ItemAttributeModifiers
§fn default() -> ItemAttributeModifiers
fn default() -> ItemAttributeModifiers
Returns the “default value” for a type. Read more
§impl PartialEq for ItemAttributeModifiers
impl PartialEq for ItemAttributeModifiers
impl StructuralPartialEq for ItemAttributeModifiers
Auto Trait Implementations§
impl Freeze for ItemAttributeModifiers
impl RefUnwindSafe for ItemAttributeModifiers
impl Send for ItemAttributeModifiers
impl Sync for ItemAttributeModifiers
impl Unpin for ItemAttributeModifiers
impl UnsafeUnpin for ItemAttributeModifiers
impl UnwindSafe for ItemAttributeModifiers
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