Record Class ChangeItemDamage
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.effects.ChangeItemDamage
- All Implemented Interfaces:
EnchantmentEntityEffect
,EnchantmentLocationBasedEffect
public record ChangeItemDamage(LevelBasedValue amount)
extends Record
implements EnchantmentEntityEffect
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LevelBasedValue
The field for theamount
record component.static final com.mojang.serialization.MapCodec
<ChangeItemDamage> -
Constructor Summary
ConstructorsConstructorDescriptionChangeItemDamage
(LevelBasedValue amount) Creates an instance of aChangeItemDamage
record class. -
Method Summary
Modifier and TypeMethodDescriptionamount()
Returns the value of theamount
record component.void
apply
(ServerLevel p_379674_, int p_379927_, EnchantedItemInUse p_380376_, Entity p_379570_, Vec3 p_380002_) com.mojang.serialization.MapCodec
<ChangeItemDamage> codec()
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.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect
onChangedBlock
Methods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
onDeactivated
-
Field Details
-
amount
The field for theamount
record component. -
CODEC
-
-
Constructor Details
-
ChangeItemDamage
Creates an instance of aChangeItemDamage
record class.- Parameters:
amount
- the value for theamount
record component
-
-
Method Details
-
apply
public void apply(ServerLevel p_379674_, int p_379927_, EnchantedItemInUse p_380376_, Entity p_379570_, Vec3 p_380002_) - Specified by:
apply
in interfaceEnchantmentEntityEffect
-
codec
- Specified by:
codec
in interfaceEnchantmentEntityEffect
- 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)
. -
amount
Returns the value of theamount
record component.- Returns:
- the value of the
amount
record component
-