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 toaxis().radialRange- Optional distance limit extending perpendicular toaxis().originOffset- Optional local/globalSpatialVectoroffset shifting the topological origin from the volume center.axis- OptionalSpatialVectordefining the cylindrical orientation axis for axial/radial decomposition.originScaling- TheDistanceScalingFunctionapplied to the overall distance from the origin.axialScaling- TheDistanceScalingFunctionapplied to the distance component parallel toaxis().radialScaling- TheDistanceScalingFunctionapplied to the distance component perpendicular toaxis().metric- TheDistanceMetric($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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringJSON field key for the optional axial range along the orientation axis.static final StringJSON field key for the axial distance scaling function.static final StringJSON field key for the optional orientation axis vector.static final com.mojang.serialization.Codec<FieldTopology> Codec for serializing and deserializingFieldTopologyinstances from JSON.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation.static final StringJSON field key for the spatial distance metric.static final StringJSON field key for the optional topological origin offset vector.static final StringJSON field key for the primary origin range.static final StringJSON field key for the origin distance scaling function.static final StringJSON field key for the optional radial range perpendicular to the orientation axis.static final StringJSON field key for the radial distance scaling function. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a defaultFieldTopologywith a constant origin range of1.0, constant scaling functions, and Euclidean distance metric.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 aFieldTopologyrecord class. -
Method Summary
Modifier and TypeMethodDescriptionOptional<net.minecraft.world.item.enchantment.LevelBasedValue> Returns the value of theaxialRangerecord component.Returns the value of theaxialScalingrecord component.axis()Returns the value of theaxisrecord component.net.minecraft.world.phys.AABBcomputeAABB(int enchantmentLevel, net.minecraft.world.entity.Entity spatialReference, net.minecraft.world.phys.Vec3 volumeCenter) Constructs a tight world-space axis-aligned bounding box enclosing the active topological range.final booleanIndicates whether some other object is "equal to" this one.floatevaluateMultiplier(int enchantmentLevel, net.minecraft.world.entity.Entity spatialReference, net.minecraft.world.phys.Vec3 epicenter, net.minecraft.world.phys.Vec3 targetPos) Evaluates the composite topological multiplier ($\text{origin} \cdot \text{axial} \cdot \text{radial}$) for a target attargetPos.net.minecraft.world.phys.Vec3getOrigin(int enchantmentLevel, net.minecraft.world.entity.Entity spatialReference, net.minecraft.world.phys.Vec3 epicenter) Calculates the absolute world-space origin coordinate for topological evaluation by applyingTopology.originOffset()to the givenepicenter.final inthashCode()Returns a hash code value for this object.metric()Returns the value of themetricrecord component.Returns the value of theoriginOffsetrecord component.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of theoriginRangerecord component.Returns the value of theoriginScalingrecord component.Optional<net.minecraft.world.item.enchantment.LevelBasedValue> Returns the value of theradialRangerecord component.Returns the value of theradialScalingrecord component.final StringtoString()Returns a string representation of this record class.withAxialRange(net.minecraft.world.item.enchantment.LevelBasedValue axialRange) Returns a copy of this topology with the specified axial range limit.withAxialScaling(DistanceScalingFunction axialScaling) Returns a copy of this topology with the specified axial distance scaling function.withAxis(SpatialVector axis) Returns a copy of this topology with the specified orientation axis vector.withDistanceMetric(DistanceMetric metric) Returns a copy of this topology with the specified spatial distance metric.withOriginOffset(SpatialVector originOffset) Returns a copy of this topology with the specified origin offset vector.withOriginRange(net.minecraft.world.item.enchantment.LevelBasedValue originRange) Returns a copy of this topology with the specified primary origin range.withOriginScaling(DistanceScalingFunction originScaling) Returns a copy of this topology with the specified origin distance scaling function.withRadialRange(net.minecraft.world.item.enchantment.LevelBasedValue radialRange) Returns a copy of this topology with the specified radial range limit.withRadialScaling(DistanceScalingFunction radialScaling) Returns a copy of this topology with the specified radial distance scaling function.
-
Field Details
-
ORIGIN_RANGE
JSON field key for the primary origin range.- See Also:
-
AXIAL_RANGE
JSON field key for the optional axial range along the orientation axis.- See Also:
-
RADIAL_RANGE
JSON field key for the optional radial range perpendicular to the orientation axis.- See Also:
-
ORIGIN_OFFSET
JSON field key for the optional topological origin offset vector.- See Also:
-
AXIS
JSON field key for the optional orientation axis vector.- See Also:
-
ORIGIN_SCALING
JSON field key for the origin distance scaling function.- See Also:
-
AXIAL_SCALING
JSON field key for the axial distance scaling function.- See Also:
-
RADIAL_SCALING
JSON field key for the radial distance scaling function.- See Also:
-
METRIC
JSON field key for the spatial distance metric.- See Also:
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
Codec for serializing and deserializingFieldTopologyinstances from JSON.
-
-
Constructor Details
-
FieldTopology
public FieldTopology()Constructs a defaultFieldTopologywith a constant origin range of1.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 aFieldTopologyrecord class.- Parameters:
originRange- the value for theoriginRangerecord componentaxialRange- the value for theaxialRangerecord componentradialRange- the value for theradialRangerecord componentoriginOffset- the value for theoriginOffsetrecord componentaxis- the value for theaxisrecord componentoriginScaling- the value for theoriginScalingrecord componentaxialScaling- the value for theaxialScalingrecord componentradialScaling- the value for theradialScalingrecord componentmetric- the value for themetricrecord 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:TopologyCalculates the absolute world-space origin coordinate for topological evaluation by applyingTopology.originOffset()to the givenepicenter.- Specified by:
getOriginin interfaceTopology- Parameters:
enchantmentLevel- The active level of the spell field enchantment.spatialReference- The entity defining the local reference frame, ornull.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:TopologyConstructs a tight world-space axis-aligned bounding box enclosing the active topological range.- Specified by:
computeAABBin interfaceTopology- Parameters:
enchantmentLevel- The active level of the spell field enchantment.spatialReference- The entity defining the local reference frame, ornull.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:TopologyEvaluates the composite topological multiplier ($\text{origin} \cdot \text{axial} \cdot \text{radial}$) for a target attargetPos.- Specified by:
evaluateMultiplierin interfaceTopology- Parameters:
enchantmentLevel- The active level of the spell field enchantment.spatialReference- The entity defining the local reference frame, ornull.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.0Fif 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 newLevelBasedValueorigin range.- Returns:
- A new
FieldTopologyinstance.
-
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 newLevelBasedValueaxial range.- Returns:
- A new
FieldTopologyinstance.
-
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 newLevelBasedValueradial range.- Returns:
- A new
FieldTopologyinstance.
-
withOriginOffset
Returns a copy of this topology with the specified origin offset vector.- Parameters:
originOffset- TheSpatialVectoroffset from the volume center.- Returns:
- A new
FieldTopologyinstance.
-
withAxis
Returns a copy of this topology with the specified orientation axis vector.- Parameters:
axis- TheSpatialVectordefining the primary orientation axis.- Returns:
- A new
FieldTopologyinstance.
-
withOriginScaling
Returns a copy of this topology with the specified origin distance scaling function.- Parameters:
originScaling- TheDistanceScalingFunctionfor origin distance falloff.- Returns:
- A new
FieldTopologyinstance.
-
withAxialScaling
Returns a copy of this topology with the specified axial distance scaling function.- Parameters:
axialScaling- TheDistanceScalingFunctionfor axial distance falloff.- Returns:
- A new
FieldTopologyinstance.
-
withRadialScaling
Returns a copy of this topology with the specified radial distance scaling function.- Parameters:
radialScaling- TheDistanceScalingFunctionfor radial distance falloff.- Returns:
- A new
FieldTopologyinstance.
-
withDistanceMetric
Returns a copy of this topology with the specified spatial distance metric.- Parameters:
metric- TheDistanceMetricto use.- Returns:
- A new
FieldTopologyinstance.
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
originRange
public net.minecraft.world.item.enchantment.LevelBasedValue originRange()Returns the value of theoriginRangerecord component.- Specified by:
originRangein interfaceTopology- Returns:
- the value of the
originRangerecord component
-
axialRange
Returns the value of theaxialRangerecord component.- Specified by:
axialRangein interfaceTopology- Returns:
- the value of the
axialRangerecord component
-
radialRange
Returns the value of theradialRangerecord component.- Specified by:
radialRangein interfaceTopology- Returns:
- the value of the
radialRangerecord component
-
originOffset
Returns the value of theoriginOffsetrecord component.- Specified by:
originOffsetin interfaceTopology- Returns:
- the value of the
originOffsetrecord component
-
axis
Returns the value of theaxisrecord component. -
originScaling
Returns the value of theoriginScalingrecord component.- Specified by:
originScalingin interfaceTopology- Returns:
- the value of the
originScalingrecord component
-
axialScaling
Returns the value of theaxialScalingrecord component.- Specified by:
axialScalingin interfaceTopology- Returns:
- the value of the
axialScalingrecord component
-
radialScaling
Returns the value of theradialScalingrecord component.- Specified by:
radialScalingin interfaceTopology- Returns:
- the value of the
radialScalingrecord component
-
metric
Returns the value of themetricrecord component.
-