public final class BlockVector3
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static BlockVector3 |
ONE |
static BlockVector3 |
UNIT_MINUS_X |
static BlockVector3 |
UNIT_MINUS_Y |
static BlockVector3 |
UNIT_MINUS_Z |
static BlockVector3 |
UNIT_X |
static BlockVector3 |
UNIT_Y |
static BlockVector3 |
UNIT_Z |
static BlockVector3 |
ZERO |
Modifier and Type | Method and Description |
---|---|
BlockVector3 |
abs()
Returns a vector with the absolute values of the components of
this vector.
|
BlockVector3 |
add(BlockVector3... others)
Add a list of vectors to this vector and return the
result as a new vector.
|
BlockVector3 |
add(BlockVector3 other)
Add another vector to this vector and return the result as a new vector.
|
BlockVector3 |
add(int x,
int y,
int z)
Add another vector to this vector and return the result as a new vector.
|
static BlockVector3 |
at(double x,
double y,
double z) |
static BlockVector3 |
at(int x,
int y,
int z) |
BlockVector3 |
ceil()
Rounds all components up.
|
static void |
checkLongPackable(BlockVector3 location) |
BlockVector3 |
clampY(int min,
int max)
Clamp the Y component.
|
boolean |
containedWithin(BlockVector3 min,
BlockVector3 max)
Checks to see if a vector is contained with another.
|
BlockVector3 |
cross(BlockVector3 other)
Gets the cross product of this and another vector.
|
double |
distance(BlockVector3 other)
Get the distance between this vector and another vector.
|
int |
distanceSq(BlockVector3 other)
Get the distance between this vector and another vector, squared.
|
BlockVector3 |
divide(BlockVector3 other)
Divide this vector by another vector on each component.
|
BlockVector3 |
divide(int n)
Perform scalar division and return a new vector.
|
BlockVector3 |
divide(int x,
int y,
int z)
Divide this vector by another vector on each component.
|
double |
dot(BlockVector3 other)
Gets the dot product of this and another vector.
|
boolean |
equals(java.lang.Object obj) |
BlockVector3 |
floor()
Floors the values of all components.
|
static BlockVector3 |
fromLongPackedForm(long packed) |
int |
getBlockX()
Get the X coordinate.
|
int |
getBlockY()
Get the Y coordinate.
|
int |
getBlockZ()
Get the Z coordinate.
|
BlockVector3 |
getMaximum(BlockVector3 v2)
Gets the maximum components of two vectors.
|
BlockVector3 |
getMinimum(BlockVector3 v2)
Gets the minimum components of two vectors.
|
int |
getX()
Get the X coordinate.
|
int |
getY()
Get the Y coordinate.
|
int |
getZ()
Get the Z coordinate.
|
int |
hashCode() |
static boolean |
isLongPackable(BlockVector3 location) |
double |
length()
Get the length of the vector.
|
int |
lengthSq()
Get the length, squared, of the vector.
|
BlockVector3 |
multiply(BlockVector3... others)
Multiply this vector by zero or more vectors on each component.
|
BlockVector3 |
multiply(BlockVector3 other)
Multiply this vector by another vector on each component.
|
BlockVector3 |
multiply(int n)
Perform scalar multiplication and return a new vector.
|
BlockVector3 |
multiply(int x,
int y,
int z)
Multiply this vector by another vector on each component.
|
BlockVector3 |
normalize()
Get the normalized vector, which is the vector divided by its
length, as a new vector.
|
BlockVector3 |
round()
Rounds all components to the closest integer.
|
BlockVector3 |
shl(int n)
Shift all components left by
n . |
BlockVector3 |
shl(int x,
int y,
int z)
Shift all components left.
|
BlockVector3 |
shr(int n)
Shift all components right by
n . |
BlockVector3 |
shr(int x,
int y,
int z)
Shift all components right.
|
static java.util.Comparator<BlockVector3> |
sortByCoordsYzx()
Returns a comparator that sorts vectors first by Y, then Z, then X.
|
BlockVector3 |
subtract(BlockVector3... others)
Subtract a list of vectors from this vector and return the result
as a new vector.
|
BlockVector3 |
subtract(BlockVector3 other)
Subtract another vector from this vector and return the result
as a new vector.
|
BlockVector3 |
subtract(int x,
int y,
int z)
Subtract another vector from this vector and return the result
as a new vector.
|
BlockVector2 |
toBlockVector2()
Creates a 2D vector by dropping the Y component from this vector.
|
long |
toLongPackedForm() |
java.lang.String |
toParserString()
Returns a string representation that is supported by the parser.
|
double |
toPitch()
Get this vector's pitch as used within the game.
|
java.lang.String |
toString() |
Vector3 |
toVector3() |
double |
toYaw()
Get this vector's yaw as used within the game.
|
BlockVector3 |
transform2D(double angle,
double aboutX,
double aboutZ,
double translateX,
double translateZ)
Perform a 2D transformation on this vector and return a new one.
|
BlockVector3 |
withX(int x)
Set the X coordinate.
|
BlockVector3 |
withY(int y)
Set the Y coordinate.
|
BlockVector3 |
withZ(int z)
Set the Z coordinate.
|
public static final BlockVector3 ZERO
public static final BlockVector3 UNIT_X
public static final BlockVector3 UNIT_Y
public static final BlockVector3 UNIT_Z
public static final BlockVector3 UNIT_MINUS_X
public static final BlockVector3 UNIT_MINUS_Y
public static final BlockVector3 UNIT_MINUS_Z
public static final BlockVector3 ONE
public static BlockVector3 at(double x, double y, double z)
public static BlockVector3 at(int x, int y, int z)
public static boolean isLongPackable(BlockVector3 location)
public static void checkLongPackable(BlockVector3 location)
public static BlockVector3 fromLongPackedForm(long packed)
public static java.util.Comparator<BlockVector3> sortByCoordsYzx()
Useful for sorting by chunk block storage order.
public long toLongPackedForm()
public int getX()
public int getBlockX()
public BlockVector3 withX(int x)
x
- the new Xpublic int getY()
public int getBlockY()
public BlockVector3 withY(int y)
y
- the new Ypublic int getZ()
public int getBlockZ()
public BlockVector3 withZ(int z)
z
- the new Zpublic BlockVector3 add(BlockVector3 other)
other
- the other vectorpublic BlockVector3 add(int x, int y, int z)
x
- the value to addy
- the value to addz
- the value to addpublic BlockVector3 add(BlockVector3... others)
others
- an array of vectorspublic BlockVector3 subtract(BlockVector3 other)
other
- the other vectorpublic BlockVector3 subtract(int x, int y, int z)
x
- the value to subtracty
- the value to subtractz
- the value to subtractpublic BlockVector3 subtract(BlockVector3... others)
others
- an array of vectorspublic BlockVector3 multiply(BlockVector3 other)
other
- the other vectorpublic BlockVector3 multiply(int x, int y, int z)
x
- the value to multiplyy
- the value to multiplyz
- the value to multiplypublic BlockVector3 multiply(BlockVector3... others)
others
- an array of vectorspublic BlockVector3 multiply(int n)
n
- the value to multiplypublic BlockVector3 divide(BlockVector3 other)
other
- the other vectorpublic BlockVector3 divide(int x, int y, int z)
x
- the value to divide byy
- the value to divide byz
- the value to divide bypublic BlockVector3 divide(int n)
n
- the value to divide bypublic BlockVector3 shr(int x, int y, int z)
x
- the value to shift x byy
- the value to shift y byz
- the value to shift z bypublic BlockVector3 shr(int n)
n
.n
- the value to shift bypublic BlockVector3 shl(int x, int y, int z)
x
- the value to shift x byy
- the value to shift y byz
- the value to shift z bypublic BlockVector3 shl(int n)
n
.n
- the value to shift bypublic double length()
public int lengthSq()
public double distance(BlockVector3 other)
other
- the other vectorpublic int distanceSq(BlockVector3 other)
other
- the other vectorpublic BlockVector3 normalize()
public double dot(BlockVector3 other)
other
- the other vectorpublic BlockVector3 cross(BlockVector3 other)
other
- the other vectorpublic boolean containedWithin(BlockVector3 min, BlockVector3 max)
min
- the minimum point (X, Y, and Z are the lowest)max
- the maximum point (X, Y, and Z are the lowest)public BlockVector3 clampY(int min, int max)
min
- the minimum valuemax
- the maximum valuepublic BlockVector3 floor()
public BlockVector3 ceil()
public BlockVector3 round()
Components < 0.5 are rounded down, otherwise up.
public BlockVector3 abs()
public BlockVector3 transform2D(double angle, double aboutX, double aboutZ, double translateX, double translateZ)
angle
- in degreesaboutX
- about which x coordinate to rotateaboutZ
- about which z coordinate to rotatetranslateX
- what to add after rotationtranslateZ
- what to add after rotationanother method to transform vectors
public double toPitch()
public double toYaw()
public BlockVector3 getMinimum(BlockVector3 v2)
v2
- the second vectorpublic BlockVector3 getMaximum(BlockVector3 v2)
v2
- the second vectorpublic BlockVector2 toBlockVector2()
BlockVector2
public Vector3 toVector3()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toParserString()