Package com.sk89q.worldedit.util
Class Location
java.lang.Object
com.sk89q.worldedit.math.Vector3
com.fastasyncworldedit.core.math.Vector3Impl
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, Vector3.hashCode()
and
equals(Object)
are subject to minor differences caused by
floating point errors.
-
Field Summary
-
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 TypeMethodDescriptionclampY
(int min, int max) Clamp the Y component.boolean
Get the direction vector.Get the direction as aDirection
.Get the extent.float
getPitch()
Get the pitch in degrees.float
getYaw()
Get the yaw in degrees.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.Methods inherited from class com.fastasyncworldedit.core.math.Vector3Impl
x, y, z
Methods inherited from class com.sk89q.worldedit.math.Vector3
abs, add, add, add, at, blockX, blockY, blockZ, ceil, containedWithin, cross, distance, distanceSq, divide, divide, divide, dot, equalsFuzzy, floor, getBlockX, getBlockY, getBlockZ, getMaximum, getMinimum, getX, getY, getZ, hashCode, length, lengthSq, multiply, multiply, multiply, multiply, mutX, mutX, mutY, mutY, mutZ, mutZ, normalize, round, roundHalfUp, setComponents, setComponents, setComponents, sortByCoordsYzx, subtract, subtract, subtract, toBlockPoint, toBlockPoint, toParserString, toPitch, toString, toVector2, toYaw, transform2D, withX, withY, withZ
-
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
-
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
-
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
-
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
-
clampY
Description copied from class:Vector3
Clamp the Y component. -
equals
-