Record Class PotionPayload
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.type.PotionPayload
- Record Components:
effect- The registryHolderof theMobEffectto apply.durationTicks- TheLevelBasedValuegoverning the effect duration in ticks.amplifier- TheLevelBasedValuegoverning the 0-indexed effect amplifier (e.g.,0for Level I).
public record PotionPayload(net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect, net.minecraft.world.item.enchantment.LevelBasedValue durationTicks, net.minecraft.world.item.enchantment.LevelBasedValue amplifier)
extends Record
Data-driven configuration record describing a status effect payload applied by
ApplyPotionEffect or
SummonLingeringPotionEffect.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringJSON field key for the effect amplifier.static final com.mojang.serialization.Codec<PotionPayload> Codec for serializing and deserializingPotionPayloadinstances from JSON.static final StringJSON field key for the duration in ticks.static final StringJSON field key for the mob effect identifier.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
Constructor Summary
ConstructorsConstructorDescriptionPotionPayload(net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect, net.minecraft.world.item.enchantment.LevelBasedValue durationTicks, net.minecraft.world.item.enchantment.LevelBasedValue amplifier) Creates an instance of aPotionPayloadrecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.enchantment.LevelBasedValueReturns the value of theamplifierrecord component.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thedurationTicksrecord component.net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect()Returns the value of theeffectrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
EFFECT
JSON field key for the mob effect identifier.- See Also:
-
DURATION_TICKS
JSON field key for the duration in ticks.- See Also:
-
AMPLIFIER
JSON field key for the effect amplifier.- See Also:
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
Codec for serializing and deserializingPotionPayloadinstances from JSON.
-
-
Constructor Details
-
PotionPayload
public PotionPayload(net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect, net.minecraft.world.item.enchantment.LevelBasedValue durationTicks, net.minecraft.world.item.enchantment.LevelBasedValue amplifier) Creates an instance of aPotionPayloadrecord class.- Parameters:
effect- the value for theeffectrecord componentdurationTicks- the value for thedurationTicksrecord componentamplifier- the value for theamplifierrecord component
-
-
Method Details
-
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). -
effect
public net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect()Returns the value of theeffectrecord component.- Returns:
- the value of the
effectrecord component
-
durationTicks
public net.minecraft.world.item.enchantment.LevelBasedValue durationTicks()Returns the value of thedurationTicksrecord component.- Returns:
- the value of the
durationTicksrecord component
-
amplifier
public net.minecraft.world.item.enchantment.LevelBasedValue amplifier()Returns the value of theamplifierrecord component.- Returns:
- the value of the
amplifierrecord component
-