Record Class SpatialVector

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.math.SpatialVector
Record Components:
x - The LevelBasedValue offset along the global $+X$ (East) axis.
y - The LevelBasedValue offset along the global $+Y$ (Up) axis.
z - The LevelBasedValue offset along the global $+Z$ (South) axis.
forward - The LevelBasedValue offset along the reference entity's FieldAxis.LONGITUDINAL view vector.
up - The LevelBasedValue offset along the reference entity's FieldAxis.VERTICAL up vector.
right - The LevelBasedValue offset along the reference entity's FieldAxis.LATERAL right 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

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<SpatialVector>
    Codec for serializing and deserializing SpatialVector instances from JSON.
    static final String
    JSON field key for the local forward component.
    Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
    static final String
    JSON field key for the local right component.
    static final String
    JSON field key for the local up component.
    static final String
    JSON field key for the global X component.
    static final String
    JSON field key for the global Y component.
    static final String
    JSON field key for the global Z component.
    static final SpatialVector
    Baseline zero-displacement instance with all global and local components set to 0.0.
  • Constructor Summary

    Constructors
    Constructor
    Description
    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 a SpatialVector record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the forward record component.
    final int
    Returns a hash code value for this object.
    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-space Vec3.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the right record component.
    final String
    Returns a string representation of this record class.
    net.minecraft.world.item.enchantment.LevelBasedValue
    up()
    Returns the value of the up record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    x()
    Returns the value of the x record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    y()
    Returns the value of the y record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    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

    • X

      public static final String X
      JSON field key for the global X component.
      See Also:
    • Y

      public static final String Y
      JSON field key for the global Y component.
      See Also:
    • Z

      public static final String Z
      JSON field key for the global Z component.
      See Also:
    • FORWARD

      public static final String FORWARD
      JSON field key for the local forward component.
      See Also:
    • UP

      public static final String UP
      JSON field key for the local up component.
      See Also:
    • KEY_PROVIDER

      public static final LevelBasedKeyProvider KEY_PROVIDER
      Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
    • CODEC

      public static final com.mojang.serialization.Codec<SpatialVector> CODEC
      Codec for serializing and deserializing SpatialVector instances from JSON.
    • ZERO

      public static final SpatialVector ZERO
      Baseline zero-displacement instance with all global and local components set to 0.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 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
      forward - the value for the forward record component
      up - the value for the up record component
      right - the value for the right record component
  • 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-space Vec3.
      Parameters:
      enchantmentLevel - The active level of the enchantment executing the resolution.
      spatialReference - The entity dictating the local coordinate reference frame, or null.
      Returns:
      The resolved composite displacement vector in world coordinates.
    • 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 Objects::equals(Object,Object).
      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 net.minecraft.world.item.enchantment.LevelBasedValue x()
      Returns the value of the x record component.
      Returns:
      the value of the x record component
    • y

      public net.minecraft.world.item.enchantment.LevelBasedValue y()
      Returns the value of the y record component.
      Returns:
      the value of the y record component
    • z

      public net.minecraft.world.item.enchantment.LevelBasedValue z()
      Returns the value of the z record component.
      Returns:
      the value of the z record component
    • forward

      public net.minecraft.world.item.enchantment.LevelBasedValue forward()
      Returns the value of the forward record component.
      Returns:
      the value of the forward record component
    • up

      public net.minecraft.world.item.enchantment.LevelBasedValue up()
      Returns the value of the up record component.
      Returns:
      the value of the up record component
    • right

      public net.minecraft.world.item.enchantment.LevelBasedValue right()
      Returns the value of the right record component.
      Returns:
      the value of the right record component