@ThreadSafe public final class Position extends Vector implements Cloneable
Constructor and Description |
---|
Position(World world,
double x,
double y,
double z) |
Modifier and Type | Method and Description |
---|---|
Position |
add(Vector vector)
Adds the x, y, and z from the vector to the coordinates of this position
|
Vector |
asUnitVector()
Obtains the unit vector pointing in the direction of the pitch and yaw
|
Vector |
asVector()
Creates new Vector with Location's coordinates
|
Block |
block()
Acquires the tile at this position
|
Chunk |
chunk()
Chunk of the current position
|
Position |
clone()
Clones this Vector.
|
static Position |
create(World world,
double x,
double y,
double z)
Wraps the point without specific yaw and pitch (set to 0)
|
static Position |
create(World world,
double x,
double y,
double z,
float yaw,
float pitch)
References the point on the world as a position that wraps the coordinates
|
double |
distance(Position position)
The distance this from position to another.
|
double |
distanceSquared(Position position)
The distance squared from this position to another
|
boolean |
equals(Object obj) |
int |
hashCode() |
float |
pitch()
The pitch of the position
|
Position |
relative(Vector vector)
Acquires the relative position to this set of coordinates
|
void |
setPitch(float pitch)
Sets the pitch of the position
|
void |
setWorld(World world)
Sets the position's world
|
void |
setYaw(float yaw)
Sets the yaw of the position
|
Vector |
toDirection()
Convert the Pitch and Yaw to a Vectorized direction
|
String |
toString() |
World |
world()
The world the position is in
|
float |
yaw()
The yaw of the position
|
public static Position create(World world, double x, double y, double z, float yaw, float pitch)
world
- the world which the point resides inx
- the x coordinatey
- the y coordinatez
- the z coordinateyaw
- goes side to side, in degreespitch
- goes up and down, in degreespublic static Position create(World world, double x, double y, double z)
world
- the world which the point resides inx
- the x coordinatey
- the y coordinatez
- the z coordinatepublic void setWorld(World world)
world
- the world to set the position topublic float yaw()
public void setYaw(float yaw)
yaw
- the yaw of the position to setpublic float pitch()
public void setPitch(float pitch)
pitch
- the pitch of the position to setpublic Position add(Vector vector)
public Position relative(Vector vector)
vector
- the vector that has the x, y, and z of the position relative to thispublic Block block()
public Vector asVector()
public Vector asUnitVector()
public double distance(Position position)
position
- the position to measure distance withpublic double distanceSquared(Position position)
position
- the position to measure distance withpublic Vector toDirection()
Copyright © 2016. All rights reserved.