Class Vector3

java.lang.Object
cn.nukkit.math.Vector3
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
NamedPosition, Particle, Vector3WithRuntimeId

public class Vector3 extends Object implements Cloneable
Author:
MagicDroidX (Nukkit Project)
  • Field Details

  • Constructor Details

    • Vector3

      public Vector3()
    • Vector3

      public Vector3(double x)
    • Vector3

      public Vector3(double x, double y)
    • Vector3

      public Vector3(double x, double y, double z)
  • Method Details

    • getX

      public double getX()
    • getY

      public double getY()
    • getZ

      public double getZ()
    • setX

      @Since("1.19.60-r1") public Vector3 setX(double x)
    • setY

      @Since("1.19.60-r1") public Vector3 setY(double y)
    • setZ

      @Since("1.19.60-r1") public Vector3 setZ(double z)
    • getFloorX

      public int getFloorX()
    • getFloorY

      public int getFloorY()
    • getFloorZ

      public int getFloorZ()
    • getChunkX

      public int getChunkX()
    • getChunkZ

      public int getChunkZ()
    • getChunkSectionY

      @PowerNukkitOnly @Since("1.4.0.0-PN") public int getChunkSectionY()
    • getChunkVector

      @PowerNukkitOnly @Since("1.4.0.0-PN") public ChunkVector2 getChunkVector()
    • getRight

      public double getRight()
    • getUp

      public double getUp()
    • getForward

      public double getForward()
    • getSouth

      public double getSouth()
    • getWest

      public double getWest()
    • add

      public Vector3 add(double x)
    • add

      public Vector3 add(double x, double y)
    • add

      public Vector3 add(double x, double y, double z)
    • add

      public Vector3 add(Vector3 x)
    • subtract

      @Deprecated @DeprecationDetails(since="1.4.0.0-PN", reason="Makes no sense", replaceWith="clone()") public Vector3 subtract()
      Deprecated.
    • subtract

      public Vector3 subtract(double x)
    • subtract

      public Vector3 subtract(double x, double y)
    • subtract

      public Vector3 subtract(double x, double y, double z)
    • subtract

      public Vector3 subtract(Vector3 x)
    • multiply

      public Vector3 multiply(double number)
    • divide

      public Vector3 divide(double number)
    • ceil

      public Vector3 ceil()
    • floor

      public Vector3 floor()
    • round

      public Vector3 round()
    • abs

      public Vector3 abs()
    • getSide

      public Vector3 getSide(BlockFace face)
    • getSide

      public Vector3 getSide(BlockFace face, int step)
    • getSideVec

      public Vector3 getSideVec(BlockFace face)
    • up

      public Vector3 up()
    • up

      public Vector3 up(int step)
    • down

      public Vector3 down()
    • down

      public Vector3 down(int step)
    • north

      public Vector3 north()
    • north

      public Vector3 north(int step)
    • south

      public Vector3 south()
    • south

      public Vector3 south(int step)
    • east

      public Vector3 east()
    • east

      public Vector3 east(int step)
    • west

      public Vector3 west()
    • west

      public Vector3 west(int step)
    • distanceManhattan

      @PowerNukkitOnly @Since("FUTURE") public int distanceManhattan(Vector3 pos)
    • distance

      public double distance(Vector3 pos)
    • distanceSquared

      public double distanceSquared(Vector3 pos)
    • distance

      @PowerNukkitOnly @Since("1.4.0.0-PN") public double distance(double x, double y, double z)
    • distanceSquared

      @PowerNukkitOnly @Since("1.4.0.0-PN") public double distanceSquared(double x, double y, double z)
    • maxPlainDistance

      public double maxPlainDistance()
    • maxPlainDistance

      public double maxPlainDistance(double x)
    • maxPlainDistance

      public double maxPlainDistance(double x, double z)
    • maxPlainDistance

      public double maxPlainDistance(Vector2 vector)
    • maxPlainDistance

      public double maxPlainDistance(Vector3 x)
    • length

      public double length()
      Calculates the Length of this Vector
      Returns:
      The Length of this Vector.
    • lengthSquared

      public double lengthSquared()
    • normalize

      public Vector3 normalize()
    • dot

      public double dot(Vector3 v)
      Scalar Product of this Vector and the Vector supplied.
      Parameters:
      v - Vector to calculate the scalar product to.
      Returns:
      Scalar Product
    • cross

      public Vector3 cross(Vector3 v)
      Calculates the cross product of this Vector and the given Vector
      Parameters:
      v - the vector to calculate the cross product with.
      Returns:
      a Vector at right angle to this and other
    • getIntermediateWithXValue

      @Nullable public Vector3 getIntermediateWithXValue(@NotNull Vector3 v, double x)
      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.
      Parameters:
      v - vector
      x - x value
      Returns:
      intermediate vector
    • getIntermediateWithYValue

      @Nullable public Vector3 getIntermediateWithYValue(@NotNull Vector3 v, double y)
      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.
      Parameters:
      v - vector
      y - y value
      Returns:
      intermediate vector
    • getIntermediateWithZValue

      @Nullable public Vector3 getIntermediateWithZValue(@NotNull Vector3 v, double z)
      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.
      Parameters:
      v - vector
      z - z value
      Returns:
      intermediate vector
    • setComponents

      public Vector3 setComponents(double x, double y, double z)
    • setComponentsAdding

      @PowerNukkitOnly @Since("1.4.0.0-PN") @NotNull public Vector3 setComponentsAdding(double x, double y, double z, double ax, double ay, double az)
    • setComponentsAdding

      @PowerNukkitOnly @Since("1.4.0.0-PN") @NotNull public Vector3 setComponentsAdding(@NotNull Vector3 pos, @NotNull BlockFace face)
    • setComponents

      @PowerNukkitOnly @Since("1.4.0.0-PN") @NotNull public Vector3 setComponents(@NotNull Vector3 pos)
    • getAxis

      @PowerNukkitOnly @Since("1.4.0.0-PN") public double getAxis(BlockFace.Axis axis)
    • toString

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • rawHashCode

      public int rawHashCode()
    • clone

      public Vector3 clone()
      Overrides:
      clone in class Object
    • asVector3f

      public Vector3f asVector3f()
    • asBlockVector3

      public BlockVector3 asBlockVector3()