Record Class SummonLingeringPotionEffect

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.effect.entity.SummonLingeringPotionEffect
Record Components:
potionEffects - The list of PotionPayload status effects added to the spawned area effect cloud.
cloudRadius - The LevelBasedValue initial radius (in blocks) of the spawned cloud.
entityFilter - Optional ContextAwarePredicate restricting 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 Details

  • Constructor Details

    • SummonLingeringPotionEffect

      public SummonLingeringPotionEffect(net.minecraft.world.item.enchantment.LevelBasedValue cloudRadius)
      Constructs an unfiltered SummonLingeringPotionEffect with an initially empty payload list.
      Parameters:
      cloudRadius - The LevelBasedValue initial cloud radius.
    • SummonLingeringPotionEffect

      public SummonLingeringPotionEffect(net.minecraft.world.item.enchantment.LevelBasedValue cloudRadius, PotionPayload... potionPayload)
      Constructs an unfiltered SummonLingeringPotionEffect with the specified initial radius and payloads.
      Parameters:
      cloudRadius - The LevelBasedValue initial cloud radius.
      potionPayload - One or more PotionPayloads 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 a SummonLingeringPotionEffect record class.
      Parameters:
      potionEffects - the value for the potionEffects record component
      cloudRadius - the value for the cloudRadius record component
      entityFilter - the value for the entityFilter record 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 an AreaEffectCloud at victim's position with a 10-tick wait time, linear radius decay over its duration, and all configured potionEffects().
      Specified by:
      apply in interface SpellFieldEntityEffect
      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 for victim.
    • codec

      public com.mojang.serialization.MapCodec<? extends SpellFieldEntityEffect> codec()
      Description copied from interface: SpellFieldEffect
      Retrieves the MapCodec responsible for serializing and deserializing this effect.
      Specified by:
      codec in interface SpellFieldEffect
      Returns:
      The registered MapCodec instance.
    • addPotionEffect

      public SummonLingeringPotionEffect addPotionEffect(PotionPayload... potionPayload)
      Returns a copy of this effect with the specified PotionPayloads appended.
      Parameters:
      potionPayload - One or more PotionPayloads to append.
      Returns:
      A new SummonLingeringPotionEffect instance.
    • 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 SummonLingeringPotionEffect instance.
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • potionEffects

      public List<PotionPayload> potionEffects()
      Returns the value of the potionEffects record component.
      Returns:
      the value of the potionEffects record component
    • cloudRadius

      public net.minecraft.world.item.enchantment.LevelBasedValue cloudRadius()
      Returns the value of the cloudRadius record component.
      Returns:
      the value of the cloudRadius record component
    • entityFilter

      public Optional<net.minecraft.advancements.critereon.ContextAwarePredicate> entityFilter()
      Returns the value of the entityFilter record component.
      Returns:
      the value of the entityFilter record component