Record Class SummonLingeringPotionEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.effect.entity.SummonLingeringPotionEffect
- Record Components:
potionEffects- The list ofPotionPayloadstatus effects added to the spawned area effect cloud.cloudRadius- TheLevelBasedValueinitial radius (in blocks) of the spawned cloud.entityFilter- OptionalContextAwarePredicaterestricting which entities trigger cloud spawning.
- All Implemented Interfaces:
SpellFieldEffect,SpellFieldEntityEffect
public record SummonLingeringPotionEffect(List<PotionPayload> potionEffects, net.minecraft.world.item.enchantment.LevelBasedValue cloudRadius, Optional<net.minecraft.advancements.critereon.ContextAwarePredicate> entityFilter)
extends Record
implements SpellFieldEntityEffect
A
SpellFieldEntityEffect that spawns a shrinking AreaEffectCloud populated with
configured PotionPayloads at the position of each targeted entity within a spell field volume.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringJSON field key for the initial cloud radius.static final com.mojang.serialization.MapCodec<SummonLingeringPotionEffect> MapCodec for serializing and deserializingSummonLingeringPotionEffectinstances from JSON.static final StringJSON field key for the optional entity filter predicate.static final StringRegistry path identifier for this spell field entity effect.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation.static final StringJSON field key for the list of potion payloads. -
Constructor Summary
ConstructorsConstructorDescriptionSummonLingeringPotionEffect(List<PotionPayload> potionEffects, net.minecraft.world.item.enchantment.LevelBasedValue cloudRadius, Optional<net.minecraft.advancements.critereon.ContextAwarePredicate> entityFilter) Creates an instance of aSummonLingeringPotionEffectrecord class.SummonLingeringPotionEffect(net.minecraft.world.item.enchantment.LevelBasedValue cloudRadius) Constructs an unfilteredSummonLingeringPotionEffectwith an initially empty payload list.SummonLingeringPotionEffect(net.minecraft.world.item.enchantment.LevelBasedValue cloudRadius, PotionPayload... potionPayload) Constructs an unfilteredSummonLingeringPotionEffectwith the specified initial radius and payloads. -
Method Summary
Modifier and TypeMethodDescriptionaddPotionEffect(PotionPayload... potionPayload) Returns a copy of this effect with the specifiedPotionPayloads appended.voidapply(net.minecraft.server.level.ServerLevel level, int enchantmentLevel, net.minecraft.world.item.enchantment.EnchantedItemInUse context, net.minecraft.world.entity.Entity spatialReference, net.minecraft.world.phys.Vec3 epicenter, net.minecraft.world.entity.Entity victim, float volumeScalar) Spawns anAreaEffectCloudatvictim's position with a 10-tick wait time, linear radius decay over its duration, and all configuredpotionEffects().net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thecloudRadiusrecord component.com.mojang.serialization.MapCodec<? extends SpellFieldEntityEffect> codec()Retrieves theMapCodecresponsible for serializing and deserializing this effect.Optional<net.minecraft.advancements.critereon.ContextAwarePredicate> Returns the value of theentityFilterrecord 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 thepotionEffectsrecord component.final StringtoString()Returns a string representation of this record class.withEntityFilter(net.minecraft.advancements.critereon.ContextAwarePredicate entityFilter) Returns a copy of this effect restricted by the specified entity predicate filter.
-
Field Details
-
POTION_EFFECTS
JSON field key for the list of potion payloads.- See Also:
-
CLOUD_RADIUS
JSON field key for the initial cloud radius.- See Also:
-
ENTITY_FILTER
JSON field key for the optional entity filter predicate.- See Also:
-
KEY
Registry path identifier for this spell field entity effect.- See Also:
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
MapCodec for serializing and deserializingSummonLingeringPotionEffectinstances from JSON.
-
-
Constructor Details
-
SummonLingeringPotionEffect
public SummonLingeringPotionEffect(net.minecraft.world.item.enchantment.LevelBasedValue cloudRadius) Constructs an unfilteredSummonLingeringPotionEffectwith an initially empty payload list.- Parameters:
cloudRadius- TheLevelBasedValueinitial cloud radius.
-
SummonLingeringPotionEffect
public SummonLingeringPotionEffect(net.minecraft.world.item.enchantment.LevelBasedValue cloudRadius, PotionPayload... potionPayload) Constructs an unfilteredSummonLingeringPotionEffectwith the specified initial radius and payloads.- Parameters:
cloudRadius- TheLevelBasedValueinitial cloud radius.potionPayload- One or morePotionPayloads to include in the cloud.
-
SummonLingeringPotionEffect
public SummonLingeringPotionEffect(List<PotionPayload> potionEffects, net.minecraft.world.item.enchantment.LevelBasedValue cloudRadius, Optional<net.minecraft.advancements.critereon.ContextAwarePredicate> entityFilter) Creates an instance of aSummonLingeringPotionEffectrecord class.- Parameters:
potionEffects- the value for thepotionEffectsrecord componentcloudRadius- the value for thecloudRadiusrecord componententityFilter- the value for theentityFilterrecord component
-
-
Method Details
-
apply
public void apply(net.minecraft.server.level.ServerLevel level, int enchantmentLevel, net.minecraft.world.item.enchantment.EnchantedItemInUse context, net.minecraft.world.entity.Entity spatialReference, net.minecraft.world.phys.Vec3 epicenter, net.minecraft.world.entity.Entity victim, float volumeScalar) Spawns anAreaEffectCloudatvictim's position with a 10-tick wait time, linear radius decay over its duration, and all configuredpotionEffects().- Specified by:
applyin interfaceSpellFieldEntityEffect- Parameters:
level- The executing server level.enchantmentLevel- The active level of the spell field enchantment.context- The item usage context triggering the spell field.spatialReference- The anchor entity or focal point of the spell field.epicenter- The exact spatial origin vector of the spell field.victim- The target entity intersecting the spell field.volumeScalar- The active topological multiplier forvictim.
-
codec
Description copied from interface:SpellFieldEffectRetrieves theMapCodecresponsible for serializing and deserializing this effect.- Specified by:
codecin interfaceSpellFieldEffect- Returns:
- The registered
MapCodecinstance.
-
addPotionEffect
Returns a copy of this effect with the specifiedPotionPayloads appended.- Parameters:
potionPayload- One or morePotionPayloads to append.- Returns:
- A new
SummonLingeringPotionEffectinstance.
-
withEntityFilter
public SummonLingeringPotionEffect withEntityFilter(net.minecraft.advancements.critereon.ContextAwarePredicate entityFilter) Returns a copy of this effect restricted by the specified entity predicate filter.- Parameters:
entityFilter- The predicate filter to match against candidate entities.- Returns:
- A new
SummonLingeringPotionEffectinstance.
-
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). -
potionEffects
Returns the value of thepotionEffectsrecord component.- Returns:
- the value of the
potionEffectsrecord component
-
cloudRadius
public net.minecraft.world.item.enchantment.LevelBasedValue cloudRadius()Returns the value of thecloudRadiusrecord component.- Returns:
- the value of the
cloudRadiusrecord component
-
entityFilter
Returns the value of theentityFilterrecord component.- Returns:
- the value of the
entityFilterrecord component
-