Record Class ItemAttributeModifiers
java.lang.Object
java.lang.Record
net.minecraft.world.item.component.ItemAttributeModifiers
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DecimalFormatstatic final com.mojang.serialization.Codec<ItemAttributeModifiers> static final ItemAttributeModifiersprivate final List<ItemAttributeModifiers.Entry> The field for themodifiersrecord component.static final StreamCodec<RegistryFriendlyByteBuf, ItemAttributeModifiers> -
Constructor Summary
ConstructorsConstructorDescriptionItemAttributeModifiers(List<ItemAttributeModifiers.Entry> modifiers) Creates an instance of aItemAttributeModifiersrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()doublecompute(double baseValue, EquipmentSlot equipmentSlot) final booleanIndicates whether some other object is "equal to" this one.voidforEach(EquipmentSlotGroup slotGroup, BiConsumer<Holder<Attribute>, AttributeModifier> action) voidforEach(EquipmentSlot equipmentSlot, BiConsumer<Holder<Attribute>, AttributeModifier> action) final inthashCode()Returns a hash code value for this object.Returns the value of themodifiersrecord component.final StringtoString()Returns a string representation of this record class.withModifierAdded(Holder<Attribute> attribute, AttributeModifier modifier, EquipmentSlotGroup slot)
-
Field Details
-
modifiers
The field for themodifiersrecord component. -
EMPTY
-
CODEC
-
STREAM_CODEC
-
ATTRIBUTE_MODIFIER_FORMAT
-
-
Constructor Details
-
ItemAttributeModifiers
Creates an instance of aItemAttributeModifiersrecord class.- Parameters:
modifiers- the value for themodifiersrecord component
-
-
Method Details
-
builder
-
withModifierAdded
public ItemAttributeModifiers withModifierAdded(Holder<Attribute> attribute, AttributeModifier modifier, EquipmentSlotGroup slot) -
forEach
public void forEach(EquipmentSlotGroup slotGroup, BiConsumer<Holder<Attribute>, AttributeModifier> action) -
forEach
public void forEach(EquipmentSlot equipmentSlot, BiConsumer<Holder<Attribute>, AttributeModifier> action) -
compute
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
modifiers
Returns the value of themodifiersrecord component.- Returns:
- the value of the
modifiersrecord component
-