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
-
Y
-
Z
-
FORWARD
-
UP
-
RIGHT
-
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
-
hashCode
-
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
-
y
-
z
-
forward
-
up
-
right
-