Record Class ItemAttributeModifiers
java.lang.Object
java.lang.Record
net.minecraft.world.item.component.ItemAttributeModifiers
public record ItemAttributeModifiers(List<ItemAttributeModifiers.Entry> modifiers, boolean showInTooltip)
extends Record
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static final record
-
Field Summary
Modifier and TypeFieldDescriptionstatic final DecimalFormat
static final com.mojang.serialization.Codec
<ItemAttributeModifiers> static final ItemAttributeModifiers
private static final com.mojang.serialization.Codec
<ItemAttributeModifiers> private final List
<ItemAttributeModifiers.Entry> The field for themodifiers
record component.private final boolean
The field for theshowInTooltip
record component.static final StreamCodec
<RegistryFriendlyByteBuf, ItemAttributeModifiers> -
Constructor Summary
ConstructorDescriptionItemAttributeModifiers
(List<ItemAttributeModifiers.Entry> modifiers, boolean showInTooltip) Creates an instance of aItemAttributeModifiers
record class. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
double
compute
(double p_330928_, EquipmentSlot p_330945_) final boolean
Indicates whether some other object is "equal to" this one.void
forEach
(EquipmentSlot p_332158_, BiConsumer<Holder<Attribute>, AttributeModifier> p_331684_) final int
hashCode()
Returns a hash code value for this object.Returns the value of themodifiers
record component.boolean
Returns the value of theshowInTooltip
record component.final String
toString()
Returns a string representation of this record class.withModifierAdded
(Holder<Attribute> p_330266_, AttributeModifier p_331954_, EquipmentSlotGroup p_332175_) withTooltip
(boolean p_335777_)
-
Field Details
-
modifiers
The field for themodifiers
record component. -
showInTooltip
private final boolean showInTooltipThe field for theshowInTooltip
record component. -
EMPTY
-
FULL_CODEC
-
CODEC
-
STREAM_CODEC
-
ATTRIBUTE_MODIFIER_FORMAT
-
-
Constructor Details
-
ItemAttributeModifiers
Creates an instance of aItemAttributeModifiers
record class.- Parameters:
modifiers
- the value for themodifiers
record componentshowInTooltip
- the value for theshowInTooltip
record component
-
-
Method Details
-
withTooltip
-
builder
-
withModifierAdded
public ItemAttributeModifiers withModifierAdded(Holder<Attribute> p_330266_, AttributeModifier p_331954_, EquipmentSlotGroup p_332175_) -
forEach
public void forEach(EquipmentSlot p_332158_, BiConsumer<Holder<Attribute>, AttributeModifier> p_331684_) -
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
modifiers
Returns the value of themodifiers
record component.- Returns:
- the value of the
modifiers
record component
-
showInTooltip
public boolean showInTooltip()Returns the value of theshowInTooltip
record component.- Returns:
- the value of the
showInTooltip
record component
-