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 serverLevel, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 position) 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 interface EnchantmentEntityEffect
onChangedBlockMethods inherited from interface EnchantmentLocationBasedEffect
onDeactivated
-
Field Details
-
toApply
-
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 serverLevel, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 position) - Specified by:
applyin interfaceEnchantmentEntityEffect
-
codec
- Specified by:
codecin interfaceEnchantmentEntityEffect- 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). -
toApply
-
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
-