Record Class SpatialVector
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.math.SpatialVector
- Record Components:
x- TheLevelBasedValueoffset along the global $+X$ (East) axis.y- TheLevelBasedValueoffset along the global $+Y$ (Up) axis.z- TheLevelBasedValueoffset along the global $+Z$ (South) axis.forward- TheLevelBasedValueoffset along the reference entity'sFieldAxis.LONGITUDINALview vector.up- TheLevelBasedValueoffset along the reference entity'sFieldAxis.VERTICALup vector.right- TheLevelBasedValueoffset along the reference entity'sFieldAxis.LATERALright vector.
public record SpatialVector(net.minecraft.world.item.enchantment.LevelBasedValue x, net.minecraft.world.item.enchantment.LevelBasedValue y, net.minecraft.world.item.enchantment.LevelBasedValue z, net.minecraft.world.item.enchantment.LevelBasedValue forward, net.minecraft.world.item.enchantment.LevelBasedValue up, net.minecraft.world.item.enchantment.LevelBasedValue right)
extends Record
Represents a composite 3D spatial vector combining world-aligned Cartesian coordinates
($x, y, z$) with entity-relative local basis coordinates ($\text{forward}, \text{up}, \text{right}$).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<SpatialVector> Codec for serializing and deserializingSpatialVectorinstances from JSON.static final StringJSON field key for the local forward component.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation.static final StringJSON field key for the local right component.static final StringJSON field key for the local up component.static final StringJSON field key for the global X component.static final StringJSON field key for the global Y component.static final StringJSON field key for the global Z component.static final SpatialVectorBaseline zero-displacement instance with all global and local components set to0.0. -
Constructor Summary
ConstructorsConstructorDescriptionSpatialVector(net.minecraft.world.item.enchantment.LevelBasedValue x, net.minecraft.world.item.enchantment.LevelBasedValue y, net.minecraft.world.item.enchantment.LevelBasedValue z, net.minecraft.world.item.enchantment.LevelBasedValue forward, net.minecraft.world.item.enchantment.LevelBasedValue up, net.minecraft.world.item.enchantment.LevelBasedValue right) Creates an instance of aSpatialVectorrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.net.minecraft.world.item.enchantment.LevelBasedValueforward()Returns the value of theforwardrecord component.final inthashCode()Returns a hash code value for this object.net.minecraft.world.phys.Vec3resolve(int enchantmentLevel, net.minecraft.world.entity.Entity spatialReference) Evaluates and sums the global Cartesian offsets and the entity-relative orientational basis offsets into a single world-spaceVec3.net.minecraft.world.item.enchantment.LevelBasedValueright()Returns the value of therightrecord component.final StringtoString()Returns a string representation of this record class.net.minecraft.world.item.enchantment.LevelBasedValueup()Returns the value of theuprecord component.net.minecraft.world.item.enchantment.LevelBasedValuex()Returns the value of thexrecord component.net.minecraft.world.item.enchantment.LevelBasedValuey()Returns the value of theyrecord component.net.minecraft.world.item.enchantment.LevelBasedValuez()Returns the value of thezrecord component.
-
Field Details
-
X
JSON field key for the global X component.- See Also:
-
Y
JSON field key for the global Y component.- See Also:
-
Z
JSON field key for the global Z component.- See Also:
-
FORWARD
JSON field key for the local forward component.- See Also:
-
UP
JSON field key for the local up component.- See Also:
-
RIGHT
JSON field key for the local right component.- See Also:
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
Codec for serializing and deserializingSpatialVectorinstances from JSON. -
ZERO
Baseline zero-displacement instance with all global and local components set to0.0.
-
-
Constructor Details
-
SpatialVector
public SpatialVector(net.minecraft.world.item.enchantment.LevelBasedValue x, net.minecraft.world.item.enchantment.LevelBasedValue y, net.minecraft.world.item.enchantment.LevelBasedValue z, net.minecraft.world.item.enchantment.LevelBasedValue forward, net.minecraft.world.item.enchantment.LevelBasedValue up, net.minecraft.world.item.enchantment.LevelBasedValue right) Creates an instance of aSpatialVectorrecord class.
-
-
Method Details
-
resolve
public net.minecraft.world.phys.Vec3 resolve(int enchantmentLevel, net.minecraft.world.entity.Entity spatialReference) Evaluates and sums the global Cartesian offsets and the entity-relative orientational basis offsets into a single world-spaceVec3.- Parameters:
enchantmentLevel- The active level of the enchantment executing the resolution.spatialReference- The entity dictating the local coordinate reference frame, ornull.- Returns:
- The resolved composite displacement vector in world coordinates.
-
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). -
x
public net.minecraft.world.item.enchantment.LevelBasedValue x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
public net.minecraft.world.item.enchantment.LevelBasedValue y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-
z
public net.minecraft.world.item.enchantment.LevelBasedValue z()Returns the value of thezrecord component.- Returns:
- the value of the
zrecord component
-
forward
public net.minecraft.world.item.enchantment.LevelBasedValue forward()Returns the value of theforwardrecord component.- Returns:
- the value of the
forwardrecord component
-
up
public net.minecraft.world.item.enchantment.LevelBasedValue up()Returns the value of theuprecord component.- Returns:
- the value of the
uprecord component
-
right
public net.minecraft.world.item.enchantment.LevelBasedValue right()Returns the value of therightrecord component.- Returns:
- the value of the
rightrecord component
-