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
Modifier and TypeFieldDescriptionprivate final LevelBasedValue
The field for theamount
record component.The field for theattribute
record component.static final com.mojang.serialization.MapCodec
<EnchantmentAttributeEffect> private final ResourceLocation
The field for theid
record component.private final AttributeModifier.Operation
The field for theoperation
record component. -
Constructor Summary
ConstructorDescriptionEnchantmentAttributeEffect
(ResourceLocation id, Holder<Attribute> attribute, LevelBasedValue amount, AttributeModifier.Operation operation) Creates an instance of aEnchantmentAttributeEffect
record class. -
Method Summary
Modifier and TypeMethodDescriptionamount()
Returns the value of theamount
record component.Returns the value of theattribute
record component.com.mojang.serialization.MapCodec
<EnchantmentAttributeEffect> codec()
final boolean
Indicates whether some other object is "equal to" this one.getModifier
(int p_342709_, StringRepresentable p_342150_) final int
hashCode()
Returns a hash code value for this object.id()
Returns the value of theid
record component.private ResourceLocation
idForSlot
(StringRepresentable p_345417_) private com.google.common.collect.HashMultimap
<Holder<Attribute>, AttributeModifier> makeAttributeMap
(int p_342373_, EquipmentSlot p_343561_) void
onChangedBlock
(ServerLevel p_342233_, int p_343426_, EnchantedItemInUse p_344251_, Entity p_342367_, Vec3 p_343372_, boolean p_342530_) void
onDeactivated
(EnchantedItemInUse p_343672_, Entity p_343519_, Vec3 p_342547_, int p_343187_) Returns the value of theoperation
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
id
The field for theid
record component. -
attribute
The field for theattribute
record component. -
amount
The field for theamount
record component. -
operation
The field for theoperation
record component. -
CODEC
-
-
Constructor Details
-
EnchantmentAttributeEffect
public EnchantmentAttributeEffect(ResourceLocation id, Holder<Attribute> attribute, LevelBasedValue amount, AttributeModifier.Operation operation) Creates an instance of aEnchantmentAttributeEffect
record class.- Parameters:
id
- the value for theid
record componentattribute
- the value for theattribute
record componentamount
- the value for theamount
record componentoperation
- the value for theoperation
record component
-
-
Method Details
-
idForSlot
-
getModifier
-
onChangedBlock
public void onChangedBlock(ServerLevel p_342233_, int p_343426_, EnchantedItemInUse p_344251_, Entity p_342367_, Vec3 p_343372_, boolean p_342530_) - Specified by:
onChangedBlock
in interfaceEnchantmentLocationBasedEffect
-
onDeactivated
public void onDeactivated(EnchantedItemInUse p_343672_, Entity p_343519_, Vec3 p_342547_, int p_343187_) - Specified by:
onDeactivated
in interfaceEnchantmentLocationBasedEffect
-
makeAttributeMap
private com.google.common.collect.HashMultimap<Holder<Attribute>,AttributeModifier> makeAttributeMap(int p_342373_, EquipmentSlot p_343561_) -
codec
- Specified by:
codec
in 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 theid
record component.- Returns:
- the value of the
id
record component
-
attribute
Returns the value of theattribute
record component.- Returns:
- the value of the
attribute
record component
-
amount
Returns the value of theamount
record component.- Returns:
- the value of the
amount
record component
-
operation
Returns the value of theoperation
record component.- Returns:
- the value of the
operation
record component
-