Record Class DamageEntity
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.effects.DamageEntity
- All Implemented Interfaces:
EnchantmentEntityEffect
,EnchantmentLocationBasedEffect
public record DamageEntity(LevelBasedValue minDamage, LevelBasedValue maxDamage, Holder<DamageType> damageType)
extends Record
implements EnchantmentEntityEffect
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec
<DamageEntity> private final Holder
<DamageType> The field for thedamageType
record component.private final LevelBasedValue
The field for themaxDamage
record component.private final LevelBasedValue
The field for theminDamage
record component. -
Constructor Summary
ConstructorDescriptionDamageEntity
(LevelBasedValue minDamage, LevelBasedValue maxDamage, Holder<DamageType> damageType) Creates an instance of aDamageEntity
record class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
apply
(ServerLevel p_345710_, int p_344734_, EnchantedItemInUse p_345002_, Entity p_345450_, Vec3 p_345442_) com.mojang.serialization.MapCodec
<DamageEntity> codec()
Returns the value of thedamageType
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.Returns the value of themaxDamage
record component.Returns the value of theminDamage
record component.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
-
minDamage
The field for theminDamage
record component. -
maxDamage
The field for themaxDamage
record component. -
damageType
The field for thedamageType
record component. -
CODEC
-
-
Constructor Details
-
DamageEntity
public DamageEntity(LevelBasedValue minDamage, LevelBasedValue maxDamage, Holder<DamageType> damageType) Creates an instance of aDamageEntity
record class.- Parameters:
minDamage
- the value for theminDamage
record componentmaxDamage
- the value for themaxDamage
record componentdamageType
- the value for thedamageType
record component
-
-
Method Details
-
apply
public void apply(ServerLevel p_345710_, int p_344734_, EnchantedItemInUse p_345002_, Entity p_345450_, Vec3 p_345442_) - 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)
. -
minDamage
Returns the value of theminDamage
record component.- Returns:
- the value of the
minDamage
record component
-
maxDamage
Returns the value of themaxDamage
record component.- Returns:
- the value of the
maxDamage
record component
-
damageType
Returns the value of thedamageType
record component.- Returns:
- the value of the
damageType
record component
-