Record Class FieldTopology

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.math.FieldTopology
Record Components:
originRange - The primary operational radius radiating from the topological origin.
axialRange - Optional distance limit extending parallel to axis().
radialRange - Optional distance limit extending perpendicular to axis().
originOffset - Optional local/global SpatialVector offset shifting the topological origin from the volume center.
axis - Optional SpatialVector defining the cylindrical orientation axis for axial/radial decomposition.
originScaling - The DistanceScalingFunction applied to the overall distance from the origin.
axialScaling - The DistanceScalingFunction applied to the distance component parallel to axis().
radialScaling - The DistanceScalingFunction applied to the distance component perpendicular to axis().
metric - The DistanceMetric ($L_2$ Euclidean or $L_1$ Manhattan) used for distance evaluation.
All Implemented Interfaces:
Topology

public record FieldTopology(net.minecraft.world.item.enchantment.LevelBasedValue originRange, Optional<net.minecraft.world.item.enchantment.LevelBasedValue> axialRange, Optional<net.minecraft.world.item.enchantment.LevelBasedValue> radialRange, Optional<SpatialVector> originOffset, Optional<SpatialVector> axis, DistanceScalingFunction originScaling, DistanceScalingFunction axialScaling, DistanceScalingFunction radialScaling, DistanceMetric metric) extends Record implements Topology
Standard data-driven record implementation of Topology defining radial, axial, and omnidirectional distance falloff rules and tight bounding-box computation for a SpellFieldVolume.
  • Field Details

    • ORIGIN_RANGE

      public static final String ORIGIN_RANGE
      JSON field key for the primary origin range.
      See Also:
    • AXIAL_RANGE

      public static final String AXIAL_RANGE
      JSON field key for the optional axial range along the orientation axis.
      See Also:
    • RADIAL_RANGE

      public static final String RADIAL_RANGE
      JSON field key for the optional radial range perpendicular to the orientation axis.
      See Also:
    • ORIGIN_OFFSET

      public static final String ORIGIN_OFFSET
      JSON field key for the optional topological origin offset vector.
      See Also:
    • AXIS

      public static final String AXIS
      JSON field key for the optional orientation axis vector.
      See Also:
    • ORIGIN_SCALING

      public static final String ORIGIN_SCALING
      JSON field key for the origin distance scaling function.
      See Also:
    • AXIAL_SCALING

      public static final String AXIAL_SCALING
      JSON field key for the axial distance scaling function.
      See Also:
    • RADIAL_SCALING

      public static final String RADIAL_SCALING
      JSON field key for the radial distance scaling function.
      See Also:
    • METRIC

      public static final String METRIC
      JSON field key for the spatial distance metric.
      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.Codec<FieldTopology> CODEC
      Codec for serializing and deserializing FieldTopology instances from JSON.
  • Constructor Details

    • FieldTopology

      public FieldTopology()
      Constructs a default FieldTopology with a constant origin range of 1.0, constant scaling functions, and Euclidean distance metric.
    • FieldTopology

      public FieldTopology(net.minecraft.world.item.enchantment.LevelBasedValue originRange, Optional<net.minecraft.world.item.enchantment.LevelBasedValue> axialRange, Optional<net.minecraft.world.item.enchantment.LevelBasedValue> radialRange, Optional<SpatialVector> originOffset, Optional<SpatialVector> axis, DistanceScalingFunction originScaling, DistanceScalingFunction axialScaling, DistanceScalingFunction radialScaling, DistanceMetric metric)
      Creates an instance of a FieldTopology record class.
      Parameters:
      originRange - the value for the originRange record component
      axialRange - the value for the axialRange record component
      radialRange - the value for the radialRange record component
      originOffset - the value for the originOffset record component
      axis - the value for the axis record component
      originScaling - the value for the originScaling record component
      axialScaling - the value for the axialScaling record component
      radialScaling - the value for the radialScaling record component
      metric - the value for the metric record component
  • Method Details

    • getOrigin

      public net.minecraft.world.phys.Vec3 getOrigin(int enchantmentLevel, net.minecraft.world.entity.Entity spatialReference, net.minecraft.world.phys.Vec3 epicenter)
      Description copied from interface: Topology
      Calculates the absolute world-space origin coordinate for topological evaluation by applying Topology.originOffset() to the given epicenter.
      Specified by:
      getOrigin in interface Topology
      Parameters:
      enchantmentLevel - The active level of the spell field enchantment.
      spatialReference - The entity defining the local reference frame, or null.
      epicenter - The base mathematical center of the volume.
      Returns:
      The offset world-space origin coordinate.
    • computeAABB

      public net.minecraft.world.phys.AABB computeAABB(int enchantmentLevel, net.minecraft.world.entity.Entity spatialReference, net.minecraft.world.phys.Vec3 volumeCenter)
      Description copied from interface: Topology
      Constructs a tight world-space axis-aligned bounding box enclosing the active topological range.
      Specified by:
      computeAABB in interface Topology
      Parameters:
      enchantmentLevel - The active level of the spell field enchantment.
      spatialReference - The entity defining the local reference frame, or null.
      volumeCenter - The mathematical center of the volume.
      Returns:
      The computed world-space AABB.
    • evaluateMultiplier

      public float evaluateMultiplier(int enchantmentLevel, net.minecraft.world.entity.Entity spatialReference, net.minecraft.world.phys.Vec3 epicenter, net.minecraft.world.phys.Vec3 targetPos)
      Description copied from interface: Topology
      Evaluates the composite topological multiplier ($\text{origin} \cdot \text{axial} \cdot \text{radial}$) for a target at targetPos.
      Specified by:
      evaluateMultiplier in interface Topology
      Parameters:
      enchantmentLevel - The active level of the spell field enchantment.
      spatialReference - The entity defining the local reference frame, or null.
      epicenter - The mathematical center of the field volume.
      targetPos - The absolute world position of the target entity or block.
      Returns:
      The scalar multiplier in $[0.0, 1.0]$, or 0.0F if the target lies outside any active range bound.
    • withOriginRange

      public FieldTopology withOriginRange(net.minecraft.world.item.enchantment.LevelBasedValue originRange)
      Returns a copy of this topology with the specified primary origin range.
      Parameters:
      originRange - The new LevelBasedValue origin range.
      Returns:
      A new FieldTopology instance.
    • withAxialRange

      public FieldTopology withAxialRange(net.minecraft.world.item.enchantment.LevelBasedValue axialRange)
      Returns a copy of this topology with the specified axial range limit.
      Parameters:
      axialRange - The new LevelBasedValue axial range.
      Returns:
      A new FieldTopology instance.
    • withRadialRange

      public FieldTopology withRadialRange(net.minecraft.world.item.enchantment.LevelBasedValue radialRange)
      Returns a copy of this topology with the specified radial range limit.
      Parameters:
      radialRange - The new LevelBasedValue radial range.
      Returns:
      A new FieldTopology instance.
    • withOriginOffset

      public FieldTopology withOriginOffset(SpatialVector originOffset)
      Returns a copy of this topology with the specified origin offset vector.
      Parameters:
      originOffset - The SpatialVector offset from the volume center.
      Returns:
      A new FieldTopology instance.
    • withAxis

      public FieldTopology withAxis(SpatialVector axis)
      Returns a copy of this topology with the specified orientation axis vector.
      Parameters:
      axis - The SpatialVector defining the primary orientation axis.
      Returns:
      A new FieldTopology instance.
    • withOriginScaling

      public FieldTopology withOriginScaling(DistanceScalingFunction originScaling)
      Returns a copy of this topology with the specified origin distance scaling function.
      Parameters:
      originScaling - The DistanceScalingFunction for origin distance falloff.
      Returns:
      A new FieldTopology instance.
    • withAxialScaling

      public FieldTopology withAxialScaling(DistanceScalingFunction axialScaling)
      Returns a copy of this topology with the specified axial distance scaling function.
      Parameters:
      axialScaling - The DistanceScalingFunction for axial distance falloff.
      Returns:
      A new FieldTopology instance.
    • withRadialScaling

      public FieldTopology withRadialScaling(DistanceScalingFunction radialScaling)
      Returns a copy of this topology with the specified radial distance scaling function.
      Parameters:
      radialScaling - The DistanceScalingFunction for radial distance falloff.
      Returns:
      A new FieldTopology instance.
    • withDistanceMetric

      public FieldTopology withDistanceMetric(DistanceMetric metric)
      Returns a copy of this topology with the specified spatial distance metric.
      Parameters:
      metric - The DistanceMetric to use.
      Returns:
      A new FieldTopology 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.
    • originRange

      public net.minecraft.world.item.enchantment.LevelBasedValue originRange()
      Returns the value of the originRange record component.
      Specified by:
      originRange in interface Topology
      Returns:
      the value of the originRange record component
    • axialRange

      public Optional<net.minecraft.world.item.enchantment.LevelBasedValue> axialRange()
      Returns the value of the axialRange record component.
      Specified by:
      axialRange in interface Topology
      Returns:
      the value of the axialRange record component
    • radialRange

      public Optional<net.minecraft.world.item.enchantment.LevelBasedValue> radialRange()
      Returns the value of the radialRange record component.
      Specified by:
      radialRange in interface Topology
      Returns:
      the value of the radialRange record component
    • originOffset

      public Optional<SpatialVector> originOffset()
      Returns the value of the originOffset record component.
      Specified by:
      originOffset in interface Topology
      Returns:
      the value of the originOffset record component
    • axis

      public Optional<SpatialVector> axis()
      Returns the value of the axis record component.
      Specified by:
      axis in interface Topology
      Returns:
      the value of the axis record component
    • originScaling

      public DistanceScalingFunction originScaling()
      Returns the value of the originScaling record component.
      Specified by:
      originScaling in interface Topology
      Returns:
      the value of the originScaling record component
    • axialScaling

      public DistanceScalingFunction axialScaling()
      Returns the value of the axialScaling record component.
      Specified by:
      axialScaling in interface Topology
      Returns:
      the value of the axialScaling record component
    • radialScaling

      public DistanceScalingFunction radialScaling()
      Returns the value of the radialScaling record component.
      Specified by:
      radialScaling in interface Topology
      Returns:
      the value of the radialScaling record component
    • metric

      public DistanceMetric metric()
      Returns the value of the metric record component.
      Specified by:
      metric in interface Topology
      Returns:
      the value of the metric record component