Record Class OrbitEffect

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.effect.entity.OrbitEffect
Record Components:
attractionStrength - The LevelBasedValue restoring force pulling entities toward the orbital ring/shell.
orbitalRadius - The LevelBasedValue target radius (in blocks) of the orbital ring from the epicenter.
orbitVelocity - The LevelBasedValue tangential speed imparted along the orbital path.
dragMultiplier - The LevelBasedValue horizontal velocity damping factor applied each tick prior to impulse addition.
distanceScaling - The DistanceScalingFunction modulating the radial restoring force based on distance from the target ring.
axis - Optional FieldAxis normal vector defining a structured 2D orbital plane.
rotationDirection - The RotationDirection (clockwise, counter-clockwise, or entity-ID parity) of the orbit.
entityFilter - Optional ContextAwarePredicate restricting which entities are pulled into orbit.
All Implemented Interfaces:
DirectionalSpellFieldEffect, SpellFieldEffect, SpellFieldEntityEffect

public record OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, Optional<FieldAxis> axis, RotationDirection rotationDirection, Optional<net.minecraft.advancements.predicates.ContextAwarePredicate> entityFilter) extends Record implements SpellFieldEntityEffect, DirectionalSpellFieldEffect
A directional SpellFieldEntityEffect that guides targeted entities into a stable circular or spherical orbit at a configurable orbitalRadius() around the spell field epicenter.

When an orientation axis() is provided, entities are pulled onto the orthogonal orbital plane and accelerated tangentially around that axis; when axis() is empty, entities enter a chaotic 3D spherical shell orbit.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    JSON field key for the radial restoring attraction strength.
    static final String
    JSON field key for the optional orbital plane normal axis.
    static final com.mojang.serialization.MapCodec<OrbitEffect>
    MapCodec for serializing and deserializing OrbitEffect instances from JSON.
    static final String
    JSON field key for the radial error distance scaling function.
    static final String
    JSON field key for the velocity damping drag factor.
    static final String
    JSON field key for the optional entity filter predicate.
    static final String
    Registry path identifier for this spell field entity effect.
    Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
    static final String
    JSON field key for the tangential orbital speed.
    static final String
    JSON field key for the target orbital radius.
    static final String
    JSON field key for the orbital rotation chirality.
  • Constructor Summary

    Constructors
    Constructor
    Description
    OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, Optional<FieldAxis> axis, RotationDirection rotationDirection, Optional<net.minecraft.advancements.predicates.ContextAwarePredicate> entityFilter)
    Creates an instance of a OrbitEffect record class.
    OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, FieldAxis axis, RotationDirection rotationDirection)
    Constructs an unfiltered planar OrbitEffect around the specified FieldAxis.
    OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, FieldAxis axis, RotationDirection rotationDirection, net.minecraft.advancements.predicates.ContextAwarePredicate entityFilter)
    Constructs a planar OrbitEffect around the specified FieldAxis and restricted by an entity filter.
    OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, RotationDirection rotationDirection)
    Constructs an unfiltered spherical OrbitEffect (no fixed axis).
    OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, RotationDirection rotationDirection, net.minecraft.advancements.predicates.ContextAwarePredicate entityFilter)
    Constructs a spherical OrbitEffect 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, net.minecraft.world.entity.Entity victim, float volumeScalar)
    Applies velocity damping, radial/planar ring-restoring attraction, and tangential orbital thrust to victim, including anti-gravity compensation for floating items and experience orbs.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the attractionStrength record component.
    Returns the value of the axis record component.
    com.mojang.serialization.MapCodec<? extends SpellFieldEntityEffect>
    Retrieves the MapCodec responsible for serializing and deserializing this effect.
    Returns the value of the distanceScaling record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the dragMultiplier record component.
    Optional<net.minecraft.advancements.predicates.ContextAwarePredicate>
    Returns the value of the entityFilter record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Retrieves the active FieldAxis along which this effect operates.
    final int
    Returns a hash code value for this object.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the orbitalRadius record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the orbitVelocity record component.
    Returns the value of the rotationDirection record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

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

    • ATTRACTION_STRENGTH

      public static final String ATTRACTION_STRENGTH
      JSON field key for the radial restoring attraction strength.
      See Also:
    • ORBITAL_RADIUS

      public static final String ORBITAL_RADIUS
      JSON field key for the target orbital radius.
      See Also:
    • ORBIT_VELOCITY

      public static final String ORBIT_VELOCITY
      JSON field key for the tangential orbital speed.
      See Also:
    • DRAG_MULTIPLIER

      public static final String DRAG_MULTIPLIER
      JSON field key for the velocity damping drag factor.
      See Also:
    • DISTANCE_SCALING

      public static final String DISTANCE_SCALING
      JSON field key for the radial error distance scaling function.
      See Also:
    • AXIS

      public static final String AXIS
      JSON field key for the optional orbital plane normal axis.
      See Also:
    • ROTATION_DIRECTION

      public static final String ROTATION_DIRECTION
      JSON field key for the orbital rotation chirality.
      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 entity 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<OrbitEffect> CODEC
      MapCodec for serializing and deserializing OrbitEffect instances from JSON.
  • Constructor Details

    • OrbitEffect

      public OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, RotationDirection rotationDirection)
      Constructs an unfiltered spherical OrbitEffect (no fixed axis).
      Parameters:
      attractionStrength - The radial attraction strength.
      orbitalRadius - The target orbital radius.
      orbitVelocity - The tangential orbital velocity.
      dragMultiplier - The velocity damping factor.
      distanceScaling - The radial error distance scaling function.
      rotationDirection - The orbital rotation direction.
    • OrbitEffect

      public OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, FieldAxis axis, RotationDirection rotationDirection)
      Constructs an unfiltered planar OrbitEffect around the specified FieldAxis.
      Parameters:
      attractionStrength - The radial attraction strength.
      orbitalRadius - The target orbital radius.
      orbitVelocity - The tangential orbital velocity.
      dragMultiplier - The velocity damping factor.
      distanceScaling - The radial error distance scaling function.
      axis - The orbital plane normal axis.
      rotationDirection - The orbital rotation direction.
    • OrbitEffect

      public OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, RotationDirection rotationDirection, net.minecraft.advancements.predicates.ContextAwarePredicate entityFilter)
      Constructs a spherical OrbitEffect restricted by an entity predicate filter.
      Parameters:
      attractionStrength - The radial attraction strength.
      orbitalRadius - The target orbital radius.
      orbitVelocity - The tangential orbital velocity.
      dragMultiplier - The velocity damping factor.
      distanceScaling - The radial error distance scaling function.
      rotationDirection - The orbital rotation direction.
      entityFilter - The predicate filter to match against candidate entities.
    • OrbitEffect

      public OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, FieldAxis axis, RotationDirection rotationDirection, net.minecraft.advancements.predicates.ContextAwarePredicate entityFilter)
      Constructs a planar OrbitEffect around the specified FieldAxis and restricted by an entity filter.
      Parameters:
      attractionStrength - The radial attraction strength.
      orbitalRadius - The target orbital radius.
      orbitVelocity - The tangential orbital velocity.
      dragMultiplier - The velocity damping factor.
      distanceScaling - The radial error distance scaling function.
      axis - The orbital plane normal axis.
      rotationDirection - The orbital rotation direction.
      entityFilter - The predicate filter to match against candidate entities.
    • OrbitEffect

      public OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, Optional<FieldAxis> axis, RotationDirection rotationDirection, Optional<net.minecraft.advancements.predicates.ContextAwarePredicate> entityFilter)
      Creates an instance of a OrbitEffect record class.
      Parameters:
      attractionStrength - the value for the attractionStrength record component
      orbitalRadius - the value for the orbitalRadius record component
      orbitVelocity - the value for the orbitVelocity record component
      dragMultiplier - the value for the dragMultiplier record component
      distanceScaling - the value for the distanceScaling record component
      axis - the value for the axis record component
      rotationDirection - the value for the rotationDirection 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 velocity damping, radial/planar ring-restoring attraction, and tangential orbital thrust to victim, including anti-gravity compensation for floating items and experience orbs.
      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.
    • getActiveAxis

      public Optional<FieldAxis> getActiveAxis()
      Description copied from interface: DirectionalSpellFieldEffect
      Retrieves the active FieldAxis along which this effect operates.
      Specified by:
      getActiveAxis in interface DirectionalSpellFieldEffect
      Returns:
      An Optional containing the configured FieldAxis, or empty if no directional axis is active.
    • 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.
    • attractionStrength

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

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

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

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

      public DistanceScalingFunction distanceScaling()
      Returns the value of the distanceScaling record component.
      Returns:
      the value of the distanceScaling record component
    • axis

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

      public RotationDirection rotationDirection()
      Returns the value of the rotationDirection record component.
      Returns:
      the value of the rotationDirection record component
    • entityFilter

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