Package com.alessiodp.core.common.utils
Class ADPLocation
- java.lang.Object
-
- com.alessiodp.core.common.utils.ADPLocation
-
- All Implemented Interfaces:
Serializable
public class ADPLocation extends Object implements Serializable
Class used as container for locations- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ADPLocation(@NotNull String serialized)ADPLocation(String world, double x, double y, double z, float yaw, float pitch)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ADPLocationadd(double x, double y, double z)Return a new location incremented axesstatic ADPLocationdeserialize(String serialized)Deserialize a string locationdoubledistance(@NotNull ADPLocation location)Gets the magnitude of the location squared.doubledistanceSquared(@NotNull ADPLocation location)Get the squared distance between this location and another.Stringserialize()Serialize the location as StringStringtoString()
-
-
-
Constructor Detail
-
ADPLocation
public ADPLocation(@NotNull @NotNull String serialized) throws IllegalArgumentException- Throws:
IllegalArgumentException
-
ADPLocation
public ADPLocation(String world, double x, double y, double z, float yaw, float pitch)
-
-
Method Detail
-
add
public ADPLocation add(double x, double y, double z)
Return a new location incremented axes- Parameters:
x- the x coordinatey- the y coordinatez- the z coordinate- Returns:
- a new location
-
distance
public double distance(@NotNull @NotNull ADPLocation location)Gets the magnitude of the location squared. Not world-aware and orientation independent.- Parameters:
location- the other location- Returns:
- the magnitude
- Throws:
IllegalArgumentException- for differing worlds
-
distanceSquared
public double distanceSquared(@NotNull @NotNull ADPLocation location)Get the squared distance between this location and another.- Parameters:
location- the other location- Returns:
- the distance
- Throws:
IllegalArgumentException- for differing worlds
-
serialize
public String serialize()
Serialize the location as String- Returns:
- the serialized location
-
deserialize
public static ADPLocation deserialize(String serialized)
Deserialize a string location- Parameters:
serialized- the location serialized- Returns:
- a new parsed location or null
-
-