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
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec
<ApplyMobEffect> private final LevelBasedValue
The field for themaxAmplifier
record component.private final LevelBasedValue
The field for themaxDuration
record component.private final LevelBasedValue
The field for theminAmplifier
record component.private final LevelBasedValue
The field for theminDuration
record component.The field for thetoApply
record component. -
Constructor Summary
ConstructorDescriptionApplyMobEffect
(HolderSet<MobEffect> toApply, LevelBasedValue minDuration, LevelBasedValue maxDuration, LevelBasedValue minAmplifier, LevelBasedValue maxAmplifier) Creates an instance of aApplyMobEffect
record class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
apply
(ServerLevel p_345355_, int p_346112_, EnchantedItemInUse p_344766_, Entity p_345996_, Vec3 p_345315_) com.mojang.serialization.MapCodec
<ApplyMobEffect> codec()
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 themaxAmplifier
record component.Returns the value of themaxDuration
record component.Returns the value of theminAmplifier
record component.Returns the value of theminDuration
record component.toApply()
Returns the value of thetoApply
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
-
toApply
The field for thetoApply
record component. -
minDuration
The field for theminDuration
record component. -
maxDuration
The field for themaxDuration
record component. -
minAmplifier
The field for theminAmplifier
record component. -
maxAmplifier
The field for themaxAmplifier
record component. -
CODEC
-
-
Constructor Details
-
ApplyMobEffect
public ApplyMobEffect(HolderSet<MobEffect> toApply, LevelBasedValue minDuration, LevelBasedValue maxDuration, LevelBasedValue minAmplifier, LevelBasedValue maxAmplifier) Creates an instance of aApplyMobEffect
record class.- Parameters:
toApply
- the value for thetoApply
record componentminDuration
- the value for theminDuration
record componentmaxDuration
- the value for themaxDuration
record componentminAmplifier
- the value for theminAmplifier
record componentmaxAmplifier
- the value for themaxAmplifier
record component
-
-
Method Details
-
apply
public void apply(ServerLevel p_345355_, int p_346112_, EnchantedItemInUse p_344766_, Entity p_345996_, Vec3 p_345315_) - 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)
. -
toApply
Returns the value of thetoApply
record component.- Returns:
- the value of the
toApply
record component
-
minDuration
Returns the value of theminDuration
record component.- Returns:
- the value of the
minDuration
record component
-
maxDuration
Returns the value of themaxDuration
record component.- Returns:
- the value of the
maxDuration
record component
-
minAmplifier
Returns the value of theminAmplifier
record component.- Returns:
- the value of the
minAmplifier
record component
-
maxAmplifier
Returns the value of themaxAmplifier
record component.- Returns:
- the value of the
maxAmplifier
record component
-