Package com.sk89q.worldedit.util
Class Location
java.lang.Object
com.sk89q.worldedit.util.Location
Represents a location in a world with has a direction.
Like Vectors
, Locations
are immutable and mutator methods
will create a new copy.
At the moment, but this may change in the future, hashCode()
and
equals(Object)
are subject to minor differences caused by
floating point errors.
-
Constructor Summary
ConstructorDescriptionCreate a new instance in the given extent at 0, 0, 0 with a direction vector of 0, 0, 0.Create a new instance in the given extent with the given coordinates with a direction vector of 0, 0, 0.Create a new instance in the given extent with the given coordinates and the given direction vector.Create a new instance in the given extent with the given coordinates and the given direction vector.Create a new instance in the given extent with the given position vector and a direction vector of 0, 0, 0.Create a new instance in the given extent with the given position vector and the given direction vector.Create a new instance in the given extent with the given position vector and the given direction vector. -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
Get the rounded X component of the position vector.int
Get the rounded Y component of the position vector.int
Get the rounded Z component of the position vector.Get the direction vector.Get the direction as aDirection
.Get the extent.float
getPitch()
Get the pitch in degrees.double
getX()
Get the X component of the position vector.double
getY()
Get the Y component of the position vector.float
getYaw()
Get the yaw in degrees.double
getZ()
Get the Z component of the position vector.int
hashCode()
setDirection
(float yaw, float pitch) Create a clone of this object with the given yaw and pitch.setDirection
(Vector3 direction) Create a clone of this object with the given direction.Create a clone of this object with the given extent.setPitch
(float pitch) Create a clone of this object with the given pitch.setPosition
(Vector3 position) Return a copy of this object with the position set to the given value.setX
(double x) Return a copy of this object with the X component of the new object set to the given value.setY
(double y) Return a copy of this object with the Y component of the new object set to the given value.setYaw
(float yaw) Create a clone of this object with the given yaw.setZ
(double z) Return a copy of this object with the Z component of the new object set to the given value.toVector()
Get aVector3
form of this location's position.
-
Constructor Details
-
Location
Create a new instance in the given extent at 0, 0, 0 with a direction vector of 0, 0, 0.- Parameters:
extent
- the extent
-
Location
Create a new instance in the given extent with the given coordinates with a direction vector of 0, 0, 0.- Parameters:
extent
- the extentx
- the X coordinatey
- the Y coordinatez
- the Z coordinate
-
Location
Create a new instance in the given extent with the given position vector and a direction vector of 0, 0, 0.- Parameters:
extent
- the extentposition
- the position vector
-
Location
Create a new instance in the given extent with the given coordinates and the given direction vector.- Parameters:
extent
- the extentx
- the X coordinatey
- the Y coordinatez
- the Z coordinatedirection
- the direction vector
-
Location
Create a new instance in the given extent with the given coordinates and the given direction vector.- Parameters:
extent
- the extentx
- the X coordinatey
- the Y coordinatez
- the Z coordinateyaw
- the yaw, in degreespitch
- the pitch, in degrees
-
Location
Create a new instance in the given extent with the given position vector and the given direction vector.- Parameters:
extent
- the extentposition
- the position vectordirection
- the direction vector
-
Location
Create a new instance in the given extent with the given position vector and the given direction vector.- Parameters:
extent
- the extentposition
- the position vectoryaw
- the yaw, in degreespitch
- the pitch, in degrees
-
-
Method Details
-
getExtent
Get the extent.- Returns:
- the extent
-
setExtent
Create a clone of this object with the given extent.- Parameters:
extent
- the new extent- Returns:
- the new instance
-
getYaw
public float getYaw()Get the yaw in degrees.- Returns:
- the yaw in degrees
-
setYaw
Create a clone of this object with the given yaw.- Parameters:
yaw
- the new yaw- Returns:
- the new instance
-
getPitch
public float getPitch()Get the pitch in degrees.- Returns:
- the pitch in degrees
-
setPitch
Create a clone of this object with the given pitch.- Parameters:
pitch
- the new yaw- Returns:
- the new instance
-
setDirection
Create a clone of this object with the given yaw and pitch.- Parameters:
yaw
- the new yawpitch
- the new pitch- Returns:
- the new instance
-
getDirection
Get the direction vector.- Returns:
- the direction vector
-
getDirectionEnum
Get the direction as aDirection
.- Returns:
- The direction
-
setDirection
Create a clone of this object with the given direction.- Parameters:
direction
- the new direction- Returns:
- the new instance
-
toVector
Get aVector3
form of this location's position.- Returns:
- a vector
-
getX
public double getX()Get the X component of the position vector.- Returns:
- the X component
-
getBlockX
public int getBlockX()Get the rounded X component of the position vector.- Returns:
- the rounded X component
-
setX
Return a copy of this object with the X component of the new object set to the given value.- Parameters:
x
- the new value for the X component- Returns:
- a new immutable instance
-
getY
public double getY()Get the Y component of the position vector.- Returns:
- the Y component
-
getBlockY
public int getBlockY()Get the rounded Y component of the position vector.- Returns:
- the rounded Y component
-
setY
Return a copy of this object with the Y component of the new object set to the given value.- Parameters:
y
- the new value for the Y component- Returns:
- a new immutable instance
-
getZ
public double getZ()Get the Z component of the position vector.- Returns:
- the Z component
-
getBlockZ
public int getBlockZ()Get the rounded Z component of the position vector.- Returns:
- the rounded Z component
-
setZ
Return a copy of this object with the Z component of the new object set to the given value.- Parameters:
z
- the new value for the Y component- Returns:
- a new immutable instance
-
setPosition
Return a copy of this object with the position set to the given value.- Parameters:
position
- The new position- Returns:
- a new immutable instance
-
equals
-
hashCode
public int hashCode()
-