Record Class SummonMirageEffect

java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.enchantment.spellfield.effect.SummonMirageEffect
Record Components:
count - Number of mirage decoys to summon into the formation (default: 3).
duration - Lifetime of the summoned mirages in ticks (default: 240).
radius - Orbital radius around the subject, or <= 0 to auto-scale with entity size.
redirectAggro - Whether nearby hostile mobs targeting the subject should redirect aggro to a mirage.
entityFilter - Optional predicate filtering which target entities can receive the mirage formation.
All Implemented Interfaces:
johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldEffect, johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldEntityEffect, johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldVolumeEffect

public record SummonMirageEffect(net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue duration, net.minecraft.world.item.enchantment.LevelBasedValue radius, boolean redirectAggro, Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> entityFilter) extends Record implements johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldEntityEffect, johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldVolumeEffect
A spell field effect that summons a synchronized orbital formation of illusory MirageEntity decoys around the target or caster entity.

Implements both SpellFieldEntityEffect and SpellFieldVolumeEffect so it can be used in either "entity_effects" or "volume_effects" (including self-targeted spell fields where context.owner() is excluded from entity_effects).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.MapCodec<SummonMirageEffect>
    The MapCodec responsible for serializing and deserializing SummonMirageEffect instances.
    static final String
    JSON field key for the mirage count parameter.
    static final String
    JSON field key for the mirage duration parameter.
    static final String
    JSON field key for the optional entity filter predicate.
    static final String
    Registry path identifier for this spell field effect ("summon_mirage").
    static final johnsmith.enchantmentcore.api.registry.LevelBasedKeyProvider
    Provides the set of JSON property keys that hold LevelBasedValues for data transformation.
    static final String
    JSON field key for the orbital radius parameter.
    static final String
    JSON field key for the aggro redirection flag.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SummonMirageEffect(net.minecraft.world.item.enchantment.LevelBasedValue count)
    Convenience constructor using the default mirage lifetime (MirageEntity.DEFAULT_MAX_LIFETIME_TICKS).
    SummonMirageEffect(net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue duration)
    Convenience constructor with auto-scaled orbital radius (0.0F), aggro redirection enabled, and no entity filter.
    SummonMirageEffect(net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue duration, net.minecraft.world.item.enchantment.LevelBasedValue radius, boolean redirectAggro, Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> entityFilter)
    Creates an instance of a SummonMirageEffect record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    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, List<johnsmith.enchantmentcore.api.enchantment.spellfield.math.GlobalVolume> volumes)
    Applies this effect as a volume-level effect, resolving the subject entity from spatialReference or context.owner().
    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)
    Applies this effect to a specific target entity within the spell field volume.
    com.mojang.serialization.MapCodec<? extends johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldEntityEffect>
    Retrieves the MapCodec for this spell field effect.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the count record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the duration record component.
    Optional<net.minecraft.advancements.criterion.ContextAwarePredicate>
    Returns the value of the entityFilter record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the radius record component.
    boolean
    Returns the value of the redirectAggro record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • COUNT

      public static final String COUNT
      JSON field key for the mirage count parameter.
      See Also:
    • DURATION

      public static final String DURATION
      JSON field key for the mirage duration parameter.
      See Also:
    • RADIUS

      public static final String RADIUS
      JSON field key for the orbital radius parameter.
      See Also:
    • REDIRECT_AGGRO

      public static final String REDIRECT_AGGRO
      JSON field key for the aggro redirection flag.
      See Also:
    • ENTITY_FILTER

      public static final String ENTITY_FILTER
      JSON field key for the optional entity filter predicate.
      See Also:
    • KEY

      public static final String KEY
      Registry path identifier for this spell field effect ("summon_mirage").
      See Also:
    • KEY_PROVIDER

      public static final johnsmith.enchantmentcore.api.registry.LevelBasedKeyProvider KEY_PROVIDER
      Provides the set of JSON property keys that hold LevelBasedValues for data transformation.
    • CODEC

      public static final com.mojang.serialization.MapCodec<SummonMirageEffect> CODEC
      The MapCodec responsible for serializing and deserializing SummonMirageEffect instances.
  • Constructor Details

    • SummonMirageEffect

      public SummonMirageEffect(net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue duration)
      Convenience constructor with auto-scaled orbital radius (0.0F), aggro redirection enabled, and no entity filter.
      Parameters:
      count - The number of mirages to summon.
      duration - The lifetime of the mirages in ticks.
    • SummonMirageEffect

      public SummonMirageEffect(net.minecraft.world.item.enchantment.LevelBasedValue count)
      Convenience constructor using the default mirage lifetime (MirageEntity.DEFAULT_MAX_LIFETIME_TICKS).
      Parameters:
      count - The number of mirages to summon.
    • SummonMirageEffect

      public SummonMirageEffect(net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue duration, net.minecraft.world.item.enchantment.LevelBasedValue radius, boolean redirectAggro, Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> entityFilter)
      Creates an instance of a SummonMirageEffect record class.
      Parameters:
      count - the value for the count record component
      duration - the value for the duration record component
      radius - the value for the radius record component
      redirectAggro - the value for the redirectAggro 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)
      Applies this effect to a specific target entity within the spell field volume.
      Specified by:
      apply in interface johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldEntityEffect
      Parameters:
      level - The executing ServerLevel.
      enchantmentLevel - The enchantment level of the spell field.
      context - The item-in-use context.
      spatialReference - The spatial reference entity.
      epicenter - The epicenter coordinates of the spell field.
      victim - The target entity receiving the mirage formation.
      volumeScalar - The topological scalar at the victim's position.
    • 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, List<johnsmith.enchantmentcore.api.enchantment.spellfield.math.GlobalVolume> volumes)
      Applies this effect as a volume-level effect, resolving the subject entity from spatialReference or context.owner().
      Specified by:
      apply in interface johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldVolumeEffect
      Parameters:
      level - The executing ServerLevel.
      enchantmentLevel - The enchantment level of the spell field.
      context - The item-in-use context.
      spatialReference - The spatial reference entity.
      epicenter - The epicenter coordinates of the spell field.
      volumes - The list of global volumes comprising the spell field.
    • codec

      public com.mojang.serialization.MapCodec<? extends johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldEntityEffect> codec()
      Retrieves the MapCodec for this spell field effect.
      Specified by:
      codec in interface johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldEffect
      Returns:
      The CODEC 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • count

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

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

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

      public boolean redirectAggro()
      Returns the value of the redirectAggro record component.
      Returns:
      the value of the redirectAggro record component
    • entityFilter

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