Record Class EnchantmentAttributeEffect
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.effects.EnchantmentAttributeEffect
- All Implemented Interfaces:
EnchantmentLocationBasedEffect
public record EnchantmentAttributeEffect(ResourceLocation id, Holder<Attribute> attribute, LevelBasedValue amount, AttributeModifier.Operation operation)
extends Record
implements EnchantmentLocationBasedEffect
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LevelBasedValueThe field for theamountrecord component.The field for theattributerecord component.static final com.mojang.serialization.MapCodec<EnchantmentAttributeEffect> private final ResourceLocationThe field for theidrecord component.private final AttributeModifier.OperationThe field for theoperationrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionEnchantmentAttributeEffect(ResourceLocation id, Holder<Attribute> attribute, LevelBasedValue amount, AttributeModifier.Operation operation) Creates an instance of aEnchantmentAttributeEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionamount()Returns the value of theamountrecord component.Returns the value of theattributerecord component.com.mojang.serialization.MapCodec<EnchantmentAttributeEffect> codec()final booleanIndicates whether some other object is "equal to" this one.getModifier(int p_345225_, StringRepresentable p_350734_) final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.private ResourceLocationidForSlot(StringRepresentable p_350940_) private com.google.common.collect.HashMultimap<Holder<Attribute>, AttributeModifier> makeAttributeMap(int p_346033_, EquipmentSlot p_350290_) voidonChangedBlock(ServerLevel p_346176_, int p_345071_, EnchantedItemInUse p_345394_, Entity p_345539_, Vec3 p_346261_, boolean p_345801_) voidonDeactivated(EnchantedItemInUse p_346016_, Entity p_346371_, Vec3 p_345145_, int p_346185_) Returns the value of theoperationrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
id
The field for theidrecord component. -
attribute
The field for theattributerecord component. -
amount
The field for theamountrecord component. -
operation
The field for theoperationrecord component. -
CODEC
-
-
Constructor Details
-
EnchantmentAttributeEffect
public EnchantmentAttributeEffect(ResourceLocation id, Holder<Attribute> attribute, LevelBasedValue amount, AttributeModifier.Operation operation) Creates an instance of aEnchantmentAttributeEffectrecord class.- Parameters:
id- the value for theidrecord componentattribute- the value for theattributerecord componentamount- the value for theamountrecord componentoperation- the value for theoperationrecord component
-
-
Method Details
-
idForSlot
-
getModifier
-
onChangedBlock
public void onChangedBlock(ServerLevel p_346176_, int p_345071_, EnchantedItemInUse p_345394_, Entity p_345539_, Vec3 p_346261_, boolean p_345801_) - Specified by:
onChangedBlockin interfaceEnchantmentLocationBasedEffect
-
onDeactivated
public void onDeactivated(EnchantedItemInUse p_346016_, Entity p_346371_, Vec3 p_345145_, int p_346185_) - Specified by:
onDeactivatedin interfaceEnchantmentLocationBasedEffect
-
makeAttributeMap
private com.google.common.collect.HashMultimap<Holder<Attribute>,AttributeModifier> makeAttributeMap(int p_346033_, EquipmentSlot p_350290_) -
codec
- Specified by:
codecin interfaceEnchantmentLocationBasedEffect
-
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). -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
attribute
Returns the value of theattributerecord component.- Returns:
- the value of the
attributerecord component
-
amount
Returns the value of theamountrecord component.- Returns:
- the value of the
amountrecord component
-
operation
Returns the value of theoperationrecord component.- Returns:
- the value of the
operationrecord component
-