Class Vec3

java.lang.Object
net.minecraft.src.Vec3

public class Vec3 extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Vec3Pool
    A global Vec3Pool that always creates new vectors instead of reusing them and is thread-safe.
    final Vec3Pool
     
    double
    X coordinate of Vec3D
    double
    Y coordinate of Vec3D
    double
    Z coordinate of Vec3D
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Vec3(Vec3Pool par1Vec3Pool, double par2, double par4, double par6)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    addVector(double par1, double par3, double par5)
    Adds the specified x,y,z vector components to this vector and returns the resulting vector.
     
    static Vec3
    createVectorHelper(double par0, double par2, double par4)
    Static method for creating a new Vec3D given the three x,y,z values.
    static Vec3
     
    crossProduct(Vec3 par1Vec3)
    Returns a new vector with the result of this vector x the specified vector.
    double
    Only considers the x and z components
    double
    distanceTo(Vec3 par1Vec3)
    Euclidean distance between this and the specified vector, returned as double.
    double
    dotProduct(Vec3 par1Vec3)
     
    getIntermediateWithXValue(Vec3 par1Vec3, double par2)
    Returns a new vector with x value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
    getIntermediateWithYValue(Vec3 par1Vec3, double par2)
    Returns a new vector with y value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
    getIntermediateWithZValue(Vec3 par1Vec3, double par2)
    Returns a new vector with z value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
    double
    Returns the length of the vector.
    Normalizes the vector to a length of 1 (except if it is the zero vector)
    void
    rotateAroundX(float par1)
    Rotates the vector around the x axis by the specified angle.
    void
    rotateAroundY(float par1)
    Rotates the vector around the y axis by the specified angle.
    void
    rotateAroundZ(float par1)
    Rotates the vector around the z axis by the specified angle.
    void
    Yaws the vector around the J axis as if it's a local coordinate internal to a block.
    void
    Yaws the vector around the origin of the J axis.
    void
    scale(double dScale)
     
    setComponents(double par1, double par3, double par5)
    Sets the x,y,z components of the vector as specified.
    double
    squareDistanceTo(double par1, double par3, double par5)
    The square of the Euclidean distance between this and the vector of x,y,z components passed in.
    double
    The square of the Euclidean distance between this and the specified vector.
    subtract(Vec3 par1Vec3)
    Returns a new vector with the result of the specified vector minus this.
    final Vec3
    Alternate name for clarity
    void
    "Tilts" the vector towards the desired facing as if it's a local coordinate internal to a block.
    void
    "Tilts" the vector towards the desired facing as if it's a local coordinate internal to a block.
     

    Methods inherited from class java.lang.Object

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

    • fakePool

      public static final Vec3Pool fakePool
      A global Vec3Pool that always creates new vectors instead of reusing them and is thread-safe.
    • myVec3LocalPool

      public final Vec3Pool myVec3LocalPool
    • xCoord

      public double xCoord
      X coordinate of Vec3D
    • yCoord

      public double yCoord
      Y coordinate of Vec3D
    • zCoord

      public double zCoord
      Z coordinate of Vec3D
  • Constructor Details

    • Vec3

      protected Vec3(Vec3Pool par1Vec3Pool, double par2, double par4, double par6)
  • Method Details

    • createVectorHelper

      public static Vec3 createVectorHelper(double par0, double par2, double par4)
      Static method for creating a new Vec3D given the three x,y,z values. This is only called from the other static method which creates and places it in the list.
    • setComponents

      public Vec3 setComponents(double par1, double par3, double par5)
      Sets the x,y,z components of the vector as specified.
    • subtract

      public Vec3 subtract(Vec3 par1Vec3)
      Returns a new vector with the result of the specified vector minus this.
    • normalize

      public Vec3 normalize()
      Normalizes the vector to a length of 1 (except if it is the zero vector)
    • dotProduct

      public double dotProduct(Vec3 par1Vec3)
    • crossProduct

      public Vec3 crossProduct(Vec3 par1Vec3)
      Returns a new vector with the result of this vector x the specified vector.
    • addVector

      public Vec3 addVector(double par1, double par3, double par5)
      Adds the specified x,y,z vector components to this vector and returns the resulting vector. Does not change this vector.
    • distanceTo

      public double distanceTo(Vec3 par1Vec3)
      Euclidean distance between this and the specified vector, returned as double.
    • squareDistanceTo

      public double squareDistanceTo(Vec3 par1Vec3)
      The square of the Euclidean distance between this and the specified vector.
    • squareDistanceTo

      public double squareDistanceTo(double par1, double par3, double par5)
      The square of the Euclidean distance between this and the vector of x,y,z components passed in.
    • lengthVector

      public double lengthVector()
      Returns the length of the vector.
    • getIntermediateWithXValue

      public Vec3 getIntermediateWithXValue(Vec3 par1Vec3, double par2)
      Returns a new vector with x value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
    • getIntermediateWithYValue

      public Vec3 getIntermediateWithYValue(Vec3 par1Vec3, double par2)
      Returns a new vector with y value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
    • getIntermediateWithZValue

      public Vec3 getIntermediateWithZValue(Vec3 par1Vec3, double par2)
      Returns a new vector with z value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • rotateAroundX

      public void rotateAroundX(float par1)
      Rotates the vector around the x axis by the specified angle.
    • rotateAroundY

      public void rotateAroundY(float par1)
      Rotates the vector around the y axis by the specified angle.
    • rotateAroundZ

      public void rotateAroundZ(float par1)
      Rotates the vector around the z axis by the specified angle.
    • createVectorHelper

      public static Vec3 createVectorHelper(Vec3 copyVector)
    • rotateAsBlockPosAroundJToFacing

      public void rotateAsBlockPosAroundJToFacing(int iFacing)
      Yaws the vector around the J axis as if it's a local coordinate internal to a block. Assumes that initial facing is along the negative K axis (facing 2)
    • rotateAsVectorAroundJToFacing

      public void rotateAsVectorAroundJToFacing(int iFacing)
      Yaws the vector around the origin of the J axis. Assumes that initial facing is along the negative K axis (facing 2)
    • tiltAsBlockPosToFacingAlongJ

      public void tiltAsBlockPosToFacingAlongJ(int iFacing)
      "Tilts" the vector towards the desired facing as if it's a local coordinate internal to a block. Takes the up vector and either yaws or rolls it towards the specified axis.
    • tiltAsVectorToFacingAlongJ

      public void tiltAsVectorToFacingAlongJ(int iFacing)
      "Tilts" the vector towards the desired facing as if it's a local coordinate internal to a block. Takes the up vector and either yaws or rolls it towards the specified axis.
    • subtractFrom

      public final Vec3 subtractFrom(Vec3 vec)
      Alternate name for clarity
    • addVector

      public Vec3 addVector(Vec3 vec)
    • scale

      public void scale(double dScale)
    • distanceSquareFlat

      public double distanceSquareFlat(Vec3 toVec)
      Only considers the x and z components