Record Class ApplyMobEffect
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.effects.ApplyMobEffect
- All Implemented Interfaces:
EnchantmentEntityEffect,EnchantmentLocationBasedEffect
public record ApplyMobEffect(HolderSet<MobEffect> toApply, LevelBasedValue minDuration, LevelBasedValue maxDuration, LevelBasedValue minAmplifier, LevelBasedValue maxAmplifier)
extends Record
implements EnchantmentEntityEffect
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<ApplyMobEffect> private final LevelBasedValueThe field for themaxAmplifierrecord component.private final LevelBasedValueThe field for themaxDurationrecord component.private final LevelBasedValueThe field for theminAmplifierrecord component.private final LevelBasedValueThe field for theminDurationrecord component.The field for thetoApplyrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionApplyMobEffect(HolderSet<MobEffect> toApply, LevelBasedValue minDuration, LevelBasedValue maxDuration, LevelBasedValue minAmplifier, LevelBasedValue maxAmplifier) Creates an instance of aApplyMobEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(ServerLevel p_345011_, int p_344950_, EnchantedItemInUse p_344081_, Entity p_344762_, Vec3 p_343893_) com.mojang.serialization.MapCodec<ApplyMobEffect> codec()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 themaxAmplifierrecord component.Returns the value of themaxDurationrecord component.Returns the value of theminAmplifierrecord component.Returns the value of theminDurationrecord component.toApply()Returns the value of thetoApplyrecord 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
-
toApply
The field for thetoApplyrecord component. -
minDuration
The field for theminDurationrecord component. -
maxDuration
The field for themaxDurationrecord component. -
minAmplifier
The field for theminAmplifierrecord component. -
maxAmplifier
The field for themaxAmplifierrecord component. -
CODEC
-
-
Constructor Details
-
ApplyMobEffect
public ApplyMobEffect(HolderSet<MobEffect> toApply, LevelBasedValue minDuration, LevelBasedValue maxDuration, LevelBasedValue minAmplifier, LevelBasedValue maxAmplifier) Creates an instance of aApplyMobEffectrecord class.- Parameters:
toApply- the value for thetoApplyrecord componentminDuration- the value for theminDurationrecord componentmaxDuration- the value for themaxDurationrecord componentminAmplifier- the value for theminAmplifierrecord componentmaxAmplifier- the value for themaxAmplifierrecord component
-
-
Method Details
-
apply
public void apply(ServerLevel p_345011_, int p_344950_, EnchantedItemInUse p_344081_, Entity p_344762_, Vec3 p_343893_) - 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). -
toApply
Returns the value of thetoApplyrecord component.- Returns:
- the value of the
toApplyrecord component
-
minDuration
Returns the value of theminDurationrecord component.- Returns:
- the value of the
minDurationrecord component
-
maxDuration
Returns the value of themaxDurationrecord component.- Returns:
- the value of the
maxDurationrecord component
-
minAmplifier
Returns the value of theminAmplifierrecord component.- Returns:
- the value of the
minAmplifierrecord component
-
maxAmplifier
Returns the value of themaxAmplifierrecord component.- Returns:
- the value of the
maxAmplifierrecord component
-