java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.effect.volume.ExplodeEffect
Record Components:
explosion - The ExplosionDefinition governing radius, block interaction, fire, and particles.
count - The LevelBasedValue number of explosions triggered when evaluated as a volume effect.
fuseTicks - The LevelBasedValue baseline delay in ticks before detonation.
fuseVariance - The LevelBasedValue random +/- tick jitter applied to the fuse delay.
spatialDelay - The LevelBasedValue additional delay in ticks per block of distance from the spell field epicenter.
distribution - Optional ProbabilityDistribution used to sample detonation points when evaluated as a volume effect.
entityFilter - Optional ContextAwarePredicate restricting which entities trigger explosions when evaluated as an entity effect.
All Implemented Interfaces:
SpellFieldEffect, SpellFieldEntityEffect, SpellFieldVolumeEffect

public record ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, Optional<ProbabilityDistribution> distribution, Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> entityFilter) extends Record implements SpellFieldEntityEffect, SpellFieldVolumeEffect
Dual-purpose spell field effect implementing both SpellFieldEntityEffect and SpellFieldVolumeEffect that schedules one or more explosions configured by an ExplosionDefinition.

Supports base fuse delays, randomized fuse variance, and distance-proportional spatial wave delays ($\text{distanceFromEpicenter} \cdot \text{spatialDelay}$) scheduled via SpellFieldTaskScheduler.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.MapCodec<ExplodeEffect>
    MapCodec for serializing and deserializing ExplodeEffect instances from JSON.
    static final String
    JSON field key for the volume explosion count.
    static final String
    JSON field key for the optional spatial probability distribution.
    static final String
    JSON field key for the optional entity filter predicate.
    static final String
    JSON field key for the nested explosion definition.
    static final String
    JSON field key for the base fuse delay in ticks.
    static final String
    JSON field key for the random fuse variance in ticks.
    static final String
    Registry path identifier for this spell field effect.
    Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
    static final String
    JSON field key for the per-block distance delay in ticks.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay)
    Constructs an unfiltered ExplodeEffect with uniform volume sampling.
    ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, Optional<ProbabilityDistribution> distribution, Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> entityFilter)
    Creates an instance of a ExplodeEffect record class.
    ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, ProbabilityDistribution distribution)
    Constructs an unfiltered ExplodeEffect with a custom spatial ProbabilityDistribution.
    ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, ProbabilityDistribution distribution, net.minecraft.advancements.criterion.ContextAwarePredicate entityFilter)
    Constructs an ExplodeEffect with both a custom ProbabilityDistribution and an entity filter.
    ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, net.minecraft.advancements.criterion.ContextAwarePredicate entityFilter)
    Constructs an ExplodeEffect restricted by an entity predicate filter.
  • 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<GlobalVolume> volumes)
    Samples count() points across volumes using distribution() (or uniform sampling if absent) and schedules an explosion at each sampled coordinate.
    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)
    Schedules an explosion centered at victim's position with its blast radius scaled by volumeScalar if the entity matches entityFilter().
    com.mojang.serialization.MapCodec<? extends SpellFieldEntityEffect>
    Retrieves the MapCodec responsible for serializing and deserializing this effect.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the count record component.
    Returns the value of the distribution 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.
    Returns the value of the explosion record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the fuseTicks record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the fuseVariance record component.
    final int
    Returns a hash code value for this object.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the spatialDelay 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

    • EXPLOSION

      public static final String EXPLOSION
      JSON field key for the nested explosion definition.
      See Also:
    • COUNT

      public static final String COUNT
      JSON field key for the volume explosion count.
      See Also:
    • FUSE_TICKS

      public static final String FUSE_TICKS
      JSON field key for the base fuse delay in ticks.
      See Also:
    • FUSE_VARIANCE

      public static final String FUSE_VARIANCE
      JSON field key for the random fuse variance in ticks.
      See Also:
    • SPATIAL_DELAY

      public static final String SPATIAL_DELAY
      JSON field key for the per-block distance delay in ticks.
      See Also:
    • DISTRIBUTION

      public static final String DISTRIBUTION
      JSON field key for the optional spatial probability distribution.
      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.
      See Also:
    • KEY_PROVIDER

      public static final LevelBasedKeyProvider KEY_PROVIDER
      Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
    • CODEC

      public static final com.mojang.serialization.MapCodec<ExplodeEffect> CODEC
      MapCodec for serializing and deserializing ExplodeEffect instances from JSON.
  • Constructor Details

    • ExplodeEffect

      public ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay)
      Constructs an unfiltered ExplodeEffect with uniform volume sampling.
      Parameters:
      explosion - The explosion parameters definition.
      count - The number of volume explosions.
      fuseTicks - The base fuse delay in ticks.
      fuseVariance - The random fuse variance in ticks.
      spatialDelay - The per-block spatial delay in ticks.
    • ExplodeEffect

      public ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, ProbabilityDistribution distribution)
      Constructs an unfiltered ExplodeEffect with a custom spatial ProbabilityDistribution.
      Parameters:
      explosion - The explosion parameters definition.
      count - The number of volume explosions.
      fuseTicks - The base fuse delay in ticks.
      fuseVariance - The random fuse variance in ticks.
      spatialDelay - The per-block spatial delay in ticks.
      distribution - The spatial probability distribution for volume sampling.
    • ExplodeEffect

      public ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, net.minecraft.advancements.criterion.ContextAwarePredicate entityFilter)
      Constructs an ExplodeEffect restricted by an entity predicate filter.
      Parameters:
      explosion - The explosion parameters definition.
      count - The number of volume explosions.
      fuseTicks - The base fuse delay in ticks.
      fuseVariance - The random fuse variance in ticks.
      spatialDelay - The per-block spatial delay in ticks.
      entityFilter - The predicate filter to match against candidate entities.
    • ExplodeEffect

      public ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, ProbabilityDistribution distribution, net.minecraft.advancements.criterion.ContextAwarePredicate entityFilter)
      Constructs an ExplodeEffect with both a custom ProbabilityDistribution and an entity filter.
      Parameters:
      explosion - The explosion parameters definition.
      count - The number of volume explosions.
      fuseTicks - The base fuse delay in ticks.
      fuseVariance - The random fuse variance in ticks.
      spatialDelay - The per-block spatial delay in ticks.
      distribution - The spatial probability distribution for volume sampling.
      entityFilter - The predicate filter to match against candidate entities.
    • ExplodeEffect

      public ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, Optional<ProbabilityDistribution> distribution, Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> entityFilter)
      Creates an instance of a ExplodeEffect record class.
      Parameters:
      explosion - the value for the explosion record component
      count - the value for the count record component
      fuseTicks - the value for the fuseTicks record component
      fuseVariance - the value for the fuseVariance record component
      spatialDelay - the value for the spatialDelay record component
      distribution - the value for the distribution 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)
      Schedules an explosion centered at victim's position with its blast radius scaled by volumeScalar if the entity matches entityFilter().
      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.
    • 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<GlobalVolume> volumes)
      Samples count() points across volumes using distribution() (or uniform sampling if absent) and schedules an explosion at each sampled coordinate.
      Specified by:
      apply in interface SpellFieldVolumeEffect
      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.
      volumes - The list of evaluated world-space GlobalVolumes defining the spell field geometry.
    • 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.
    • 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.
    • explosion

      public ExplosionDefinition explosion()
      Returns the value of the explosion record component.
      Returns:
      the value of the explosion record component
    • 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
    • fuseTicks

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

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

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

      public Optional<ProbabilityDistribution> distribution()
      Returns the value of the distribution record component.
      Returns:
      the value of the distribution 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