Record Class EnchantmentAttributeEffect
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.effects.EnchantmentAttributeEffect
- All Implemented Interfaces:
EnchantmentLocationBasedEffect
public record EnchantmentAttributeEffect(Identifier 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.private final IdentifierThe field for theidrecord component.static final com.mojang.serialization.MapCodec<EnchantmentAttributeEffect> private final AttributeModifier.OperationThe field for theoperationrecord component.Fields inherited from interface EnchantmentLocationBasedEffect
CODEC -
Constructor Summary
ConstructorsConstructorDescriptionEnchantmentAttributeEffect(Identifier 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 level, StringRepresentable slot) final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.private IdentifieridForSlot(StringRepresentable slot) private HashMultimap<Holder<Attribute>, AttributeModifier> makeAttributeMap(int enchantmentLevel, EquipmentSlot slot) voidonChangedBlock(ServerLevel serverLevel, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 position, boolean becameActive) voidonDeactivated(EnchantedItemInUse item, Entity entity, Vec3 position, int level) 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
-
amount
The field for theamountrecord component. -
operation
The field for theoperationrecord component. -
MAP_CODEC
-
-
Constructor Details
-
EnchantmentAttributeEffect
public EnchantmentAttributeEffect(Identifier 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 serverLevel, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 position, boolean becameActive) - Specified by:
onChangedBlockin interfaceEnchantmentLocationBasedEffect
-
onDeactivated
- Specified by:
onDeactivatedin interfaceEnchantmentLocationBasedEffect
-
makeAttributeMap
private HashMultimap<Holder<Attribute>, AttributeModifier> makeAttributeMap(int enchantmentLevel, EquipmentSlot slot) -
codec
- Specified by:
codecin interfaceEnchantmentLocationBasedEffect
-
toString
-
hashCode
-
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
-
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
-