Record Class AttributeUtil.BaseModifier
java.lang.Object
java.lang.Record
net.neoforged.neoforge.common.util.AttributeUtil.BaseModifier
- Enclosing class:
AttributeUtil
private static record AttributeUtil.BaseModifier(net.minecraft.world.entity.ai.attributes.AttributeModifier base, List<net.minecraft.world.entity.ai.attributes.AttributeModifier> children)
extends Record
Stores a single base modifier (determined by
IAttributeExtension.getBaseId()
) and any other children non-base modifiers for the same attribute.
Used during attribute merging logic within AttributeUtil.applyTextFor(net.minecraft.world.item.ItemStack, java.util.function.Consumer<net.minecraft.network.chat.Component>, com.google.common.collect.Multimap<net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute>, net.minecraft.world.entity.ai.attributes.AttributeModifier>, net.neoforged.neoforge.common.util.AttributeTooltipContext)
.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
BaseModifier
(net.minecraft.world.entity.ai.attributes.AttributeModifier base, List<net.minecraft.world.entity.ai.attributes.AttributeModifier> children) Creates an instance of aBaseModifier
record class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.entity.ai.attributes.AttributeModifier
base()
Returns the value of thebase
record component.List
<net.minecraft.world.entity.ai.attributes.AttributeModifier> children()
Returns the value of thechildren
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
base
private final net.minecraft.world.entity.ai.attributes.AttributeModifier baseThe field for thebase
record component. -
children
The field for thechildren
record component.
-
-
Constructor Details
-
BaseModifier
private BaseModifier(net.minecraft.world.entity.ai.attributes.AttributeModifier base, List<net.minecraft.world.entity.ai.attributes.AttributeModifier> children) Creates an instance of aBaseModifier
record class.- Parameters:
base
- the value for thebase
record componentchildren
- the value for thechildren
record component
-
-
Method Details
-
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)
. -
base
public net.minecraft.world.entity.ai.attributes.AttributeModifier base()Returns the value of thebase
record component.- Returns:
- the value of the
base
record component
-
children
Returns the value of thechildren
record component.- Returns:
- the value of the
children
record component
-