java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.structure.processor.rule.SpatialVector
Record Components:
x - Global world X axis weight.
y - Global world Y axis weight.
z - Global world Z axis weight.
right - Template-local X (width/right) axis weight.
up - Template-local Y (height/up) axis weight.
forward - Template-local Z (length/forward) axis weight.

public record SpatialVector(float x, float y, float z, float right, float up, float forward) extends Record
Represents a directional axis that combines both global (world-absolute) coordinates and structure-relative (template-local) coordinates for use in GradientOutput.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<SpatialVector>
    The codec responsible for serializing and deserializing SpatialVector instances from JSON.
    static final SpatialVector
    Default vertical axis vector pointing along the global Y axis (y = 1.0F).
  • Constructor Summary

    Constructors
    Constructor
    Description
    SpatialVector(float x, float y, float z, float right, float up, float forward)
    Creates an instance of a SpatialVector record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    dot(net.minecraft.core.BlockPos localPos, net.minecraft.core.BlockPos absolutePos)
    Calculates the scalar dot-product projection distance of the current block position along this spatial axis.
    final boolean
    Indicates whether some other object is "equal to" this one.
    float
    Returns the value of the forward record component.
    final int
    Returns a hash code value for this object.
    float
    Returns the value of the right record component.
    final String
    Returns a string representation of this record class.
    float
    up()
    Returns the value of the up record component.
    float
    x()
    Returns the value of the x record component.
    float
    y()
    Returns the value of the y record component.
    float
    z()
    Returns the value of the z record component.

    Methods inherited from class java.lang.Object

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

    • UP

      public static final SpatialVector UP
      Default vertical axis vector pointing along the global Y axis (y = 1.0F).
    • CODEC

      public static final com.mojang.serialization.Codec<SpatialVector> CODEC
      The codec responsible for serializing and deserializing SpatialVector instances from JSON.
  • Constructor Details

    • SpatialVector

      public SpatialVector(float x, float y, float z, float right, float up, float forward)
      Creates an instance of a SpatialVector record class.
      Parameters:
      x - the value for the x record component
      y - the value for the y record component
      z - the value for the z record component
      right - the value for the right record component
      up - the value for the up record component
      forward - the value for the forward record component
  • Method Details

    • dot

      public float dot(net.minecraft.core.BlockPos localPos, net.minecraft.core.BlockPos absolutePos)
      Calculates the scalar dot-product projection distance of the current block position along this spatial axis.

      By utilizing the unrotated localPos for right, up, and forward, relative evaluations always apply consistently to the structure template's original orientation regardless of how the piece was rotated into the world.

      Parameters:
      localPos - The unrotated template-local block position.
      absolutePos - The transformed world-space block position.
      Returns:
      The combined scalar projection distance.
    • 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 '=='.
      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.
    • x

      public float x()
      Returns the value of the x record component.
      Returns:
      the value of the x record component
    • y

      public float y()
      Returns the value of the y record component.
      Returns:
      the value of the y record component
    • z

      public float z()
      Returns the value of the z record component.
      Returns:
      the value of the z record component
    • right

      public float right()
      Returns the value of the right record component.
      Returns:
      the value of the right record component
    • up

      public float up()
      Returns the value of the up record component.
      Returns:
      the value of the up record component
    • forward

      public float forward()
      Returns the value of the forward record component.
      Returns:
      the value of the forward record component