Record Class VectorFieldVisualEffect

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.effect.visual.VectorFieldVisualEffect
Record Components:
particle - The ParticleOptions defining the particle type to spawn.
count - The LevelBasedValue total number of particles spawned per evaluation cycle.
speed - The LevelBasedValue signed speed multiplier (negative values invert the directional polarity).
axis - Optional explicit FieldAxis overriding automatic axis inheritance from sibling effects.
distribution - The ProbabilityDistribution used to sample topological spawn coordinates across the volumes.
All Implemented Interfaces:
SpellFieldEffect, SpellFieldVisualEffect

public record VectorFieldVisualEffect(net.minecraft.core.particles.ParticleOptions particle, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue speed, Optional<FieldAxis> axis, ProbabilityDistribution distribution) extends Record implements SpellFieldVisualEffect
A SpellFieldVisualEffect that spawns directional particles across the spell field's GlobalVolumes whose velocity vectors align with a configured FieldAxis or automatically inherit the active axes of sibling DirectionalSpellFieldEffects.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    JSON field key for the optional explicit directional axis.
    static final com.mojang.serialization.MapCodec<VectorFieldVisualEffect>
    MapCodec for serializing and deserializing VectorFieldVisualEffect instances from JSON.
    static final String
    JSON field key for the particle count.
    static final String
    JSON field key for the spatial probability distribution.
    static final String
    Registry path identifier for this spell field visual effect.
    Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
    static final String
    JSON field key for the particle options definition.
    static final String
    JSON field key for the signed particle speed multiplier.
  • Constructor Summary

    Constructors
    Constructor
    Description
    VectorFieldVisualEffect(net.minecraft.core.particles.ParticleOptions particle, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue speed, Optional<FieldAxis> axis, ProbabilityDistribution distribution)
    Creates an instance of a VectorFieldVisualEffect record class.
    VectorFieldVisualEffect(net.minecraft.core.particles.ParticleOptions particle, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue speed, ProbabilityDistribution distribution)
    Constructs a VectorFieldVisualEffect that automatically inherits its directional axis from sibling effects in the spell field.
    VectorFieldVisualEffect(net.minecraft.core.particles.ParticleOptions particle, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue speed, FieldAxis axis, ProbabilityDistribution distribution)
    Constructs a VectorFieldVisualEffect aligned with an explicit FieldAxis.
  • 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 target, net.minecraft.world.phys.Vec3 epicenter, List<GlobalVolume> volumes, List<FieldAxis> activeAxes)
    Samples count() points across volumes and spawns velocity-aligned particles along axis() (or a randomly chosen axis from activeAxes, falling back to random omnidirectional drift if no axis is available).
    Returns the value of the axis record component.
    com.mojang.serialization.MapCodec<? extends SpellFieldVisualEffect>
    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.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    net.minecraft.core.particles.ParticleOptions
    Returns the value of the particle record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the speed 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

  • Constructor Details

    • VectorFieldVisualEffect

      public VectorFieldVisualEffect(net.minecraft.core.particles.ParticleOptions particle, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue speed, ProbabilityDistribution distribution)
      Constructs a VectorFieldVisualEffect that automatically inherits its directional axis from sibling effects in the spell field.
      Parameters:
      particle - The particle options to spawn.
      count - The LevelBasedValue particle count.
      speed - The LevelBasedValue signed particle speed.
      distribution - The spatial probability distribution for sampling spawn points.
    • VectorFieldVisualEffect

      public VectorFieldVisualEffect(net.minecraft.core.particles.ParticleOptions particle, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue speed, FieldAxis axis, ProbabilityDistribution distribution)
      Constructs a VectorFieldVisualEffect aligned with an explicit FieldAxis.
      Parameters:
      particle - The particle options to spawn.
      count - The LevelBasedValue particle count.
      speed - The LevelBasedValue signed particle speed.
      axis - The explicit FieldAxis dictating particle velocity direction.
      distribution - The spatial probability distribution for sampling spawn points.
    • VectorFieldVisualEffect

      public VectorFieldVisualEffect(net.minecraft.core.particles.ParticleOptions particle, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue speed, Optional<FieldAxis> axis, ProbabilityDistribution distribution)
      Creates an instance of a VectorFieldVisualEffect record class.
      Parameters:
      particle - the value for the particle record component
      count - the value for the count record component
      speed - the value for the speed record component
      axis - the value for the axis record component
      distribution - the value for the distribution 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 target, net.minecraft.world.phys.Vec3 epicenter, List<GlobalVolume> volumes, List<FieldAxis> activeAxes)
      Samples count() points across volumes and spawns velocity-aligned particles along axis() (or a randomly chosen axis from activeAxes, falling back to random omnidirectional drift if no axis is available).
      Specified by:
      apply in interface SpellFieldVisualEffect
      Parameters:
      level - The executing server level.
      enchantmentLevel - The active level of the spell field enchantment.
      context - The item usage context triggering the spell field.
      target - 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.
      activeAxes - The list of active directional FieldAxis instances collected from sibling effects.
    • codec

      public com.mojang.serialization.MapCodec<? extends SpellFieldVisualEffect> 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.
    • particle

      public net.minecraft.core.particles.ParticleOptions particle()
      Returns the value of the particle record component.
      Returns:
      the value of the particle 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
    • speed

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

      public Optional<FieldAxis> axis()
      Returns the value of the axis record component.
      Returns:
      the value of the axis record component
    • distribution

      public ProbabilityDistribution distribution()
      Returns the value of the distribution record component.
      Returns:
      the value of the distribution record component