Record Class SpatialVector
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
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<SpatialVector> The codec responsible for serializing and deserializingSpatialVectorinstances from JSON.static final SpatialVectorDefault vertical axis vector pointing along the global Y axis (y = 1.0F). -
Constructor Summary
ConstructorsConstructorDescriptionSpatialVector(float x, float y, float z, float right, float up, float forward) Creates an instance of aSpatialVectorrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfloatdot(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 booleanIndicates whether some other object is "equal to" this one.floatforward()Returns the value of theforwardrecord component.final inthashCode()Returns a hash code value for this object.floatright()Returns the value of therightrecord component.final StringtoString()Returns a string representation of this record class.floatup()Returns the value of theuprecord component.floatx()Returns the value of thexrecord component.floaty()Returns the value of theyrecord component.floatz()Returns the value of thezrecord component.
-
Field Details
-
UP
Default vertical axis vector pointing along the global Y axis (y = 1.0F). -
CODEC
The codec responsible for serializing and deserializingSpatialVectorinstances from JSON.
-
-
Constructor Details
-
SpatialVector
public SpatialVector(float x, float y, float z, float right, float up, float forward) Creates an instance of aSpatialVectorrecord class.
-
-
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
localPosforright,up, andforward, 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
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 with '=='. -
x
public float x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
public float y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-
z
public float z()Returns the value of thezrecord component.- Returns:
- the value of the
zrecord component
-
right
public float right()Returns the value of therightrecord component.- Returns:
- the value of the
rightrecord component
-
up
public float up()Returns the value of theuprecord component.- Returns:
- the value of the
uprecord component
-
forward
public float forward()Returns the value of theforwardrecord component.- Returns:
- the value of the
forwardrecord component
-