Class Vector3d
java.lang.Object
com.github.retrooper.packetevents.util.Vector3d
3D double Vector.
This vector can represent coordinates, angles, or anything you want.
You can use this to represent an array if you really want.
- Since:
- 1.8
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(double x, double y, double z) crossProduct
(Vector3d other) static Vector3d
decode
(NBT tag, ClientVersion version) double
double
distanceSquared
(Vector3d other) double
static NBT
encode
(Vector3d vector3d, ClientVersion version) boolean
Is the object we are comparing to equal to us? It must be of type Vector3d or Vector3i and all values must be equal to the values in this class.double
getX()
double
getY()
double
getZ()
int
hashCode()
double
length()
double
multiply
(double value) multiply
(double x, double y, double z) static Vector3d
read
(PacketWrapper<?> wrapper) subtract
(double x, double y, double z) toString()
withX
(double x) withY
(double y) withZ
(double z) static void
write
(PacketWrapper<?> wrapper, Vector3d vector) static Vector3d
zero()
-
Field Details
-
x
public final double xX (coordinate/angle/whatever you wish) -
y
public final double yY (coordinate/angle/whatever you wish) -
z
public final double zZ (coordinate/angle/whatever you wish)
-
-
Constructor Details
-
Vector3d
public Vector3d()Default constructor setting all coordinates/angles/values to their default values (=0). -
Vector3d
public Vector3d(double x, double y, double z) Constructor allowing you to set the values.- Parameters:
x
- Xy
- Yz
- Z
-
Vector3d
public Vector3d(double[] array) Constructor allowing you to specify an array. X will be set to the first index of an array(if it exists, otherwise 0). Y will be set to the second index of an array(if it exists, otherwise 0). Z will be set to the third index of an array(if it exists, otherwise 0).- Parameters:
array
- Array.
-
-
Method Details
-
read
-
write
-
decode
-
encode
-
getX
public double getX() -
getY
public double getY() -
getZ
public double getZ() -
equals
Is the object we are comparing to equal to us? It must be of type Vector3d or Vector3i and all values must be equal to the values in this class. -
hashCode
public int hashCode() -
add
-
add
-
offset
-
subtract
-
subtract
-
multiply
-
multiply
-
multiply
-
crossProduct
-
dot
-
with
-
withX
-
withY
-
withZ
-
distance
-
length
public double length() -
lengthSquared
public double lengthSquared() -
normalize
-
distanceSquared
-
toVector3i
-
toString
-
zero
-