|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.bukkit.Location
public class Location
Represents a 3-dimensional position in a world
| Constructor Summary | |
|---|---|
Location(World world,
double x,
double y,
double z)
Constructs a new Location with the given coordinates |
|
Location(World world,
double x,
double y,
double z,
float yaw,
float pitch)
Constructs a new Location with the given coordinates and direction |
|
| Method Summary | |
|---|---|
Location |
add(double x,
double y,
double z)
Adds the location by another. |
Location |
add(Location vec)
Adds the location by another. |
Location |
add(Vector vec)
Adds the location by a vector. |
Location |
clone()
|
double |
distance(Location o)
Get the distance between this location and another. |
double |
distanceSquared(Location o)
Get the squared distance between this location and another. |
boolean |
equals(Object obj)
|
Block |
getBlock()
Gets the block at the represented location |
int |
getBlockX()
Gets the floored value of the X component, indicating the block that this location is contained with. |
int |
getBlockY()
Gets the floored value of the Y component, indicating the block that this location is contained with. |
int |
getBlockZ()
Gets the floored value of the Z component, indicating the block that this location is contained with. |
Chunk |
getChunk()
Gets the chunk at the represented location |
Vector |
getDirection()
Gets a Vector pointing in the direction that this Location is facing |
float |
getPitch()
Gets the pitch of this location |
World |
getWorld()
Gets the world that this location resides in |
double |
getX()
Gets the x-coordinate of this location |
double |
getY()
Gets the y-coordinate of this location |
float |
getYaw()
Gets the yaw of this location |
double |
getZ()
Gets the z-coordinate of this location |
int |
hashCode()
|
double |
length()
Gets the magnitude of the location, defined as sqrt(x^2+y^2+z^2). |
double |
lengthSquared()
Gets the magnitude of the location squared. |
static int |
locToBlock(double loc)
Safely converts a double (location coordinate) to an int (block coordinate) |
Location |
multiply(double m)
Performs scalar multiplication, multiplying all components with a scalar. |
void |
setPitch(float pitch)
Sets the pitch of this location |
void |
setWorld(World world)
Sets the world that this location resides in |
void |
setX(double x)
Sets the x-coordinate of this location |
void |
setY(double y)
Sets the y-coordinate of this location |
void |
setYaw(float yaw)
Sets the yaw of this location |
void |
setZ(double z)
Sets the z-coordinate of this location |
Location |
subtract(double x,
double y,
double z)
Subtracts the location by another. |
Location |
subtract(Location vec)
Subtracts the location by another. |
Location |
subtract(Vector vec)
Subtracts the location by a vector. |
String |
toString()
|
Vector |
toVector()
Constructs a new Vector based on this Location |
Location |
zero()
Zero this location's components. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Location(World world,
double x,
double y,
double z)
world - The world in which this location residesx - The x-coordinate of this new locationy - The y-coordinate of this new locationz - The z-coordinate of this new location
public Location(World world,
double x,
double y,
double z,
float yaw,
float pitch)
world - The world in which this location residesx - The x-coordinate of this new locationy - The y-coordinate of this new locationz - The z-coordinate of this new locationyaw - The absolute rotation on the x-plane, in degreespitch - The absolute rotation on the y-plane, in degrees| Method Detail |
|---|
public void setWorld(World world)
world - New world that this location resides inpublic World getWorld()
public Chunk getChunk()
public Block getBlock()
public void setX(double x)
x - X-coordinatepublic double getX()
public int getBlockX()
public void setY(double y)
y - y-coordinatepublic double getY()
public int getBlockY()
public void setZ(double z)
z - z-coordinatepublic double getZ()
public int getBlockZ()
public void setYaw(float yaw)
yaw - New yawpublic float getYaw()
public void setPitch(float pitch)
pitch - New pitchpublic float getPitch()
public Vector getDirection()
public Location add(Location vec)
vec - The other location
IllegalArgumentException - for differing worldsVectorpublic Location add(Vector vec)
vec - Vector to use
Vector
public Location add(double x,
double y,
double z)
x - X coordinatey - Y coordinatez - Z coordinate
Vectorpublic Location subtract(Location vec)
vec - The other location
IllegalArgumentException - for differing worldsVectorpublic Location subtract(Vector vec)
vec - The vector to use
Vector
public Location subtract(double x,
double y,
double z)
x - X coordinatey - Y coordinatez - Z coordinate
Vectorpublic double length()
Vectorpublic double lengthSquared()
Vectorpublic double distance(Location o)
o - The other location
IllegalArgumentException - for differing worldsVectorpublic double distanceSquared(Location o)
o - The other location
IllegalArgumentException - for differing worldsVectorpublic Location multiply(double m)
m - The factor
Vectorpublic Location zero()
Vectorpublic boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Objectpublic Vector toVector()
Vector based on this Location
public Location clone()
clone in class Objectpublic static int locToBlock(double loc)
loc - Precise coordinate
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||