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
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<DamageEntity> private final Holder<DamageType> The field for thedamageTyperecord component.private final LevelBasedValueThe field for themaxDamagerecord component.private final LevelBasedValueThe field for theminDamagerecord component. -
Constructor Summary
ConstructorsConstructorDescriptionDamageEntity(LevelBasedValue minDamage, LevelBasedValue maxDamage, Holder<DamageType> damageType) Creates an instance of aDamageEntityrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(ServerLevel pLevel, int pEnchantmentLevel, EnchantedItemInUse pItem, Entity pEntity, Vec3 pOrigin) com.mojang.serialization.MapCodec<DamageEntity> codec()Returns the value of thedamageTyperecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of themaxDamagerecord component.Returns the value of theminDamagerecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect
onChangedBlockMethods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
onDeactivated
-
Field Details
-
minDamage
The field for theminDamagerecord component. -
maxDamage
The field for themaxDamagerecord component. -
damageType
The field for thedamageTyperecord component. -
CODEC
-
-
Constructor Details
-
DamageEntity
public DamageEntity(LevelBasedValue minDamage, LevelBasedValue maxDamage, Holder<DamageType> damageType) Creates an instance of aDamageEntityrecord class.- Parameters:
minDamage- the value for theminDamagerecord componentmaxDamage- the value for themaxDamagerecord componentdamageType- the value for thedamageTyperecord component
-
-
Method Details
-
apply
public void apply(ServerLevel pLevel, int pEnchantmentLevel, EnchantedItemInUse pItem, Entity pEntity, Vec3 pOrigin) - Specified by:
applyin interfaceEnchantmentEntityEffect
-
codec
- Specified by:
codecin interfaceEnchantmentEntityEffect- 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). -
minDamage
Returns the value of theminDamagerecord component.- Returns:
- the value of the
minDamagerecord component
-
maxDamage
Returns the value of themaxDamagerecord component.- Returns:
- the value of the
maxDamagerecord component
-
damageType
Returns the value of thedamageTyperecord component.- Returns:
- the value of the
damageTyperecord component
-