net.tridentsdk.base

## Class Position

• All Implemented Interfaces:
Serializable, Cloneable

```@ThreadSafe
public final class Position
extends Vector
implements Cloneable```
Represents a point on the coordinate grid of the world, including pitch and yaw
Since:
0.3-alpha-DP
Author:
The TridentSDK Team
Serialized Form

• ### Fields inherited from class net.tridentsdk.util.Vector

`x, y, z`
• ### Constructor Summary

Constructors
Constructor and Description
```Position(World world, double x, double y, double z)```
• ### Method Summary

All Methods
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
• ### Methods inherited from class net.tridentsdk.util.Vector

`add, add, asLocation, crossProduct, divide, divide, divide, divide, dotProduct, magnitude, magnitudeSquared, multiply, multiply, multiply, multiply, normalize, setX, setY, setZ, subtract, subtract, subtract, x, y, z`
• ### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`
• ### Constructor Detail

• #### Position

```public Position(World world,
double x,
double y,
double z)```
• ### Method Detail

• #### create

```public 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
Parameters:
`world` - the world which the point resides in
`x` - the x coordinate
`y` - the y coordinate
`z` - the z coordinate
`yaw` - goes side to side, in degrees
`pitch` - goes up and down, in degrees
• #### create

```public static Position create(World world,
double x,
double y,
double z)```
Wraps the point without specific yaw and pitch (set to 0)
Parameters:
`world` - the world which the point resides in
`x` - the x coordinate
`y` - the y coordinate
`z` - the z coordinate
• #### world

`public World world()`
The world the position is in
Returns:
the world where the position is
• #### chunk

`public Chunk chunk()`
Chunk of the current position
Returns:
Chunk of the position
• #### setWorld

`public void setWorld(World world)`
Sets the position's world
Parameters:
`world` - the world to set the position to
• #### yaw

`public float yaw()`
The yaw of the position
Returns:
the yaw of this position
• #### setYaw

`public void setYaw(float yaw)`
Sets the yaw of the position
Parameters:
`yaw` - the yaw of the position to set
• #### pitch

`public float pitch()`
The pitch of the position
Returns:
the pitch value of this position
• #### setPitch

`public void setPitch(float pitch)`
Sets the pitch of the position
Parameters:
`pitch` - the pitch of the position to set

`public Position add(Vector vector)`
Adds the x, y, and z from the vector to the coordinates of this position
Overrides:
`add` in class `Vector`
Parameters:
`vector` - the vector containing the relative data
Returns:
the relative position
• #### relative

`public Position relative(Vector vector)`
Acquires the relative position to this set of coordinates
Parameters:
`vector` - the vector that has the x, y, and z of the position relative to this
Returns:
the relative position
• #### block

`public Block block()`
Acquires the tile at this position
Returns:
the tile occupying the coordinates of this position
• #### asVector

`public Vector asVector()`
Creates new Vector with Location's coordinates
Returns:
New Vector containing this Location's coordinates
• #### asUnitVector

`public Vector asUnitVector()`
Obtains the unit vector pointing in the direction of the pitch and yaw
Returns:
the direction vector
• #### distance

`public double distance(Position position)`
The distance this from position to another. Math.sqrt is costly, ergo calling this method a lot is not advised.
Parameters:
`position` - the position to measure distance with
Returns:
distance from this position to another
• #### distanceSquared

`public double distanceSquared(Position position)`
The distance squared from this position to another
Parameters:
`position` - the position to measure distance with
Returns:
distance squared from this position to another
• #### toDirection

`public Vector toDirection()`
Convert the Pitch and Yaw to a Vectorized direction
Returns:
Vector of the direction of the position
• #### clone

`public Position clone()`
Description copied from class: `Vector`
Clones this Vector.
Overrides:
`clone` in class `Vector`
Returns:
the cloned vector
• #### equals

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

`public int hashCode()`
Overrides:
`hashCode` in class `Vector`
• #### toString

`public String toString()`
Overrides:
`toString` in class `Vector`