Interface Location
- All Superinterfaces:
FinePosition, Position
A fine position in a given world, along with a rotation.
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault doubledistanceSquared(Location other) Computes the squared distance between this location and another one in the same world.static LocationCreates a location at the given coordinates, facing a yaw and pitch of0.static LocationCreates a location at the given coordinates and rotation.offset(double x, double y, double z) Moves this position along all three axes.offset(int x, int y, int z) Moves this position along all three axes by a whole number of blocks.offsetX(double x) Moves this position along the X axis.offsetX(int x) Moves this position along the X axis by a whole number of blocks.offsetY(double y) Moves this position along the Y axis.offsetY(int y) Moves this position along the Y axis by a whole number of blocks.offsetZ(double z) Moves this position along the Z axis.offsetZ(int z) Moves this position along the Z axis by a whole number of blocks.floatpitch()Gets the pitch of this location, which is its vertical rotation.Moves this position by one block in the direction of the given face.Moves this position by the defined distance in the direction of the given face.rotation()Gets the rotation of this location.with(double x, double y, double z) Copies this position with different coordinates.with(double x, double y, double z, float yaw, float pitch) Copies this location with different coordinates and rotation, in the same world.with(int x, int y, int z) Copies this position with different whole coordinates.withRotation(float yaw, float pitch) Copies this location with a different rotation, at the same coordinates and in the same world.withRotation(Rotation rotation) Copies this location with a different rotation, at the same coordinates and in the same world.withX(double x) Copies this position with a different X coordinate.withX(int x) Copies this position with a different whole X coordinate.withY(double y) Copies this position with a different Y coordinate.withY(int y) Copies this position with a different whole Y coordinate.withZ(double z) Copies this position with a different Z coordinate.withZ(int z) Copies this position with a different whole Z coordinate.world()Gets the world this location is in.floatyaw()Gets the yaw of this location, which is its horizontal rotation.
-
Method Details
-
of
@Contract(value="_, _, _, _ -> new", pure=true) static Location of(World world, double x, double y, double z) Creates a location at the given coordinates, facing a yaw and pitch of0.- Parameters:
world- the world of the locationx- the X coordinatey- the Y coordinatez- the Z coordinate- Returns:
- a new location at the given coordinates, with a yaw and pitch of
0 - Since:
- 0.1.0
-
of
@Contract(value="_, _, _, _, _, _ -> new", pure=true) static Location of(World world, double x, double y, double z, float yaw, float pitch) Creates a location at the given coordinates and rotation.- Parameters:
world- the world of the locationx- the X coordinatey- the Y coordinatez- the Z coordinateyaw- the yaw, in degreespitch- the pitch, in degrees- Returns:
- a new location at the given coordinates and rotation
- Since:
- 0.1.0
-
relative
Description copied from interface:PositionMoves this position by the defined distance in the direction of the given face.- Specified by:
relativein interfaceFinePosition- Specified by:
relativein interfacePosition- Parameters:
face- the direction to move towardsdistance- the offset distance- Returns:
- a new position moved by one block towards the given face
-
relative
Description copied from interface:PositionMoves this position by one block in the direction of the given face.- Specified by:
relativein interfaceFinePosition- Specified by:
relativein interfacePosition- Parameters:
face- the direction to move towards- Returns:
- a new position moved by one block towards the given face
- See Also:
-
offsetX
Description copied from interface:PositionMoves this position along the X axis. -
offsetY
Description copied from interface:PositionMoves this position along the Y axis. -
offsetZ
Description copied from interface:PositionMoves this position along the Z axis. -
offset
Description copied from interface:PositionMoves this position along all three axes. -
offsetX
Description copied from interface:PositionMoves this position along the X axis by a whole number of blocks.- Specified by:
offsetXin interfaceFinePosition- Specified by:
offsetXin interfacePosition- Parameters:
x- the amount to add to the X coordinate- Returns:
- a new position of the same kind with the given amount added to the X coordinate
-
offsetY
Description copied from interface:PositionMoves this position along the Y axis by a whole number of blocks.- Specified by:
offsetYin interfaceFinePosition- Specified by:
offsetYin interfacePosition- Parameters:
y- the amount to add to the Y coordinate- Returns:
- a new position of the same kind with the given amount added to the Y coordinate
-
offsetZ
Description copied from interface:PositionMoves this position along the Z axis by a whole number of blocks.- Specified by:
offsetZin interfaceFinePosition- Specified by:
offsetZin interfacePosition- Parameters:
z- the amount to add to the Z coordinate- Returns:
- a new position of the same kind with the given amount added to the Z coordinate
-
offset
Description copied from interface:PositionMoves this position along all three axes by a whole number of blocks.- Specified by:
offsetin interfaceFinePosition- Specified by:
offsetin interfacePosition- Parameters:
x- the amount to add to the X coordinatey- the amount to add to the Y coordinatez- the amount to add to the Z coordinate- Returns:
- a new position of the same kind with the given amounts added to each coordinate
-
withX
-
withY
-
withZ
-
with
Description copied from interface:PositionCopies this position with different coordinates. -
with
@Contract(value="_, _, _, _, _ -> new", pure=true) Location with(double x, double y, double z, float yaw, float pitch) Copies this location with different coordinates and rotation, in the same world.- Parameters:
x- the new X coordinatey- the new Y coordinatez- the new Z coordinateyaw- the new yaw, in degreespitch- the new pitch, in degrees- Returns:
- a new location in the same world with all coordinates and the rotation replaced
- Since:
- 0.1.0
-
withX
Description copied from interface:PositionCopies this position with a different whole X coordinate.- Specified by:
withXin interfaceFinePosition- Specified by:
withXin interfacePosition- Parameters:
x- the new X coordinate- Returns:
- a new position of the same kind with the X coordinate replaced
-
withY
Description copied from interface:PositionCopies this position with a different whole Y coordinate.- Specified by:
withYin interfaceFinePosition- Specified by:
withYin interfacePosition- Parameters:
y- the new Y coordinate- Returns:
- a new position of the same kind with the Y coordinate replaced
-
withZ
Description copied from interface:PositionCopies this position with a different whole Z coordinate.- Specified by:
withZin interfaceFinePosition- Specified by:
withZin interfacePosition- Parameters:
z- the new Z coordinate- Returns:
- a new position of the same kind with the Z coordinate replaced
-
with
Description copied from interface:PositionCopies this position with different whole coordinates.- Specified by:
within interfaceFinePosition- Specified by:
within interfacePosition- Parameters:
x- the new X coordinatey- the new Y coordinatez- the new Z coordinate- Returns:
- a new position of the same kind with all coordinates replaced
-
rotation
-
withRotation
Copies this location with a different rotation, at the same coordinates and in the same world.- Parameters:
rotation- the new rotation- Returns:
- a new location at the same coordinates with the rotation replaced
- Since:
- 0.1.0
-
withRotation
Copies this location with a different rotation, at the same coordinates and in the same world.- Parameters:
yaw- the new yaw, in degreespitch- the new pitch, in degrees- Returns:
- a new location at the same coordinates with the rotation replaced
- Since:
- 0.1.0
-
world
-
pitch
-
yaw
-
distanceSquared
Computes the squared distance between this location and another one in the same world.- Parameters:
other- the location to measure the distance to- Returns:
- the squared euclidean distance between this location and another
- Throws:
IllegalArgumentException- if the other location is in a different world- Since:
- 0.1.0
- See Also:
-