![]() |
Bukkit
1.4.7-R1.0
|
Represents a 3-dimensional position in a world. More...
Inheritance diagram for org.bukkit.Location:
Collaboration diagram for org.bukkit.Location:Public Member Functions | |
| Location (final World world, final double x, final double y, final double z) | |
| Constructs a new Location with the given coordinates. | |
| Location (final World world, final double x, final double y, final double z, final float yaw, final float pitch) | |
| Constructs a new Location with the given coordinates and direction. | |
| void | setWorld (World world) |
| Sets the world that this location resides in. | |
| World | getWorld () |
| Gets the world that this location resides in. | |
| Chunk | getChunk () |
| Gets the chunk at the represented location. | |
| Block | getBlock () |
| Gets the block at the represented location. | |
| void | setX (double x) |
| Sets the x-coordinate of this location. | |
| double | getX () |
| Gets the x-coordinate of this location. | |
| int | getBlockX () |
| Gets the floored value of the X component, indicating the block that this location is contained with. | |
| void | setY (double y) |
| Sets the y-coordinate of this location. | |
| double | getY () |
| Gets the y-coordinate of this location. | |
| int | getBlockY () |
| Gets the floored value of the Y component, indicating the block that this location is contained with. | |
| void | setZ (double z) |
| Sets the z-coordinate of this location. | |
| double | getZ () |
| Gets the z-coordinate of this location. | |
| int | getBlockZ () |
| Gets the floored value of the Z component, indicating the block that this location is contained with. | |
| void | setYaw (float yaw) |
| Sets the yaw of this location. | |
| float | getYaw () |
| Gets the yaw of this location. | |
| void | setPitch (float pitch) |
| Sets the pitch of this location. | |
| float | getPitch () |
| Gets the pitch of this location. | |
| Vector | getDirection () |
| Gets a Vector pointing in the direction that this Location is facing. | |
| Location | add (Location vec) |
| Adds the location by another. | |
| Location | add (Vector vec) |
| Adds the location by a vector. | |
| Location | add (double x, double y, double z) |
| Adds the location by another. | |
| Location | subtract (Location vec) |
| Subtracts the location by another. | |
| Location | subtract (Vector vec) |
| Subtracts the location by a vector. | |
| Location | subtract (double x, double y, double z) |
| Subtracts the location by another. | |
| 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. | |
| 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. | |
| Location | multiply (double m) |
| Performs scalar multiplication, multiplying all components with a scalar. | |
| Location | zero () |
| Zero this location's components. | |
| boolean | equals (Object obj) |
| int | hashCode () |
| String | toString () |
| Vector | toVector () |
| Constructs a new Vector based on this Location. | |
| Location | clone () |
Static Public Member Functions | |
| static int | locToBlock (double loc) |
| Safely converts a double (location coordinate) to an int (block coordinate) | |
Represents a 3-dimensional position in a world.
Definition at line 10 of file Location.java.
| org.bukkit.Location.Location | ( | final World | world, |
| final double | x, | ||
| final double | y, | ||
| final double | z | ||
| ) |
Constructs a new Location with the given coordinates.
| world | The world in which this location resides |
| x | The x-coordinate of this new location |
| y | The y-coordinate of this new location |
| z | The z-coordinate of this new location |
Definition at line 26 of file Location.java.
Referenced by org.bukkit.Location.equals().
| org.bukkit.Location.Location | ( | final World | world, |
| final double | x, | ||
| final double | y, | ||
| final double | z, | ||
| final float | yaw, | ||
| final float | pitch | ||
| ) |
Constructs a new Location with the given coordinates and direction.
| world | The world in which this location resides |
| x | The x-coordinate of this new location |
| y | The y-coordinate of this new location |
| z | The z-coordinate of this new location |
| yaw | The absolute rotation on the x-plane, in degrees |
| pitch | The absolute rotation on the y-plane, in degrees |
Definition at line 40 of file Location.java.
Adds the location by another.
| vec | The other location |
| IllegalArgumentException | for differing worlds |
Definition at line 234 of file Location.java.
References org.bukkit.Location.getWorld().
Adds the location by a vector.
| vec | Vector to use |
Definition at line 252 of file Location.java.
References org.bukkit.util.Vector.getX(), org.bukkit.util.Vector.getY(), and org.bukkit.util.Vector.getZ().
| Location org.bukkit.Location.add | ( | double | x, |
| double | y, | ||
| double | z | ||
| ) |
Adds the location by another.
Not world-aware.
| x | X coordinate |
| y | Y coordinate |
| z | Z coordinate |
Definition at line 268 of file Location.java.
| Location org.bukkit.Location.clone | ( | ) |
Definition at line 474 of file Location.java.
References org.bukkit.Location.clone().
Referenced by org.bukkit.Location.clone().
| double org.bukkit.Location.distance | ( | Location | o | ) |
Get the distance between this location and another.
The value of this method is not cached and uses a costly square-root function, so do not repeatedly call this method to get the location's magnitude. NaN will be returned if the inner result of the sqrt() function overflows, which will be caused if the distance is too long.
| o | The other location |
| IllegalArgumentException | for differing worlds |
Definition at line 363 of file Location.java.
References org.bukkit.Location.distanceSquared().
| double org.bukkit.Location.distanceSquared | ( | Location | o | ) |
Get the squared distance between this location and another.
| o | The other location |
| IllegalArgumentException | for differing worlds |
Definition at line 375 of file Location.java.
References org.bukkit.World.getName(), and org.bukkit.Location.getWorld().
Referenced by org.bukkit.Location.distance().
| boolean org.bukkit.Location.equals | ( | Object | obj | ) |
Definition at line 416 of file Location.java.
References org.bukkit.Location.Location().
| Block org.bukkit.Location.getBlock | ( | ) |
Gets the block at the represented location.
Definition at line 81 of file Location.java.
References org.bukkit.World.getBlockAt().
| int org.bukkit.Location.getBlockX | ( | ) |
Gets the floored value of the X component, indicating the block that this location is contained with.
Definition at line 109 of file Location.java.
References org.bukkit.Location.locToBlock().
| int org.bukkit.Location.getBlockY | ( | ) |
Gets the floored value of the Y component, indicating the block that this location is contained with.
Definition at line 137 of file Location.java.
References org.bukkit.Location.locToBlock().
| int org.bukkit.Location.getBlockZ | ( | ) |
Gets the floored value of the Z component, indicating the block that this location is contained with.
Definition at line 165 of file Location.java.
References org.bukkit.Location.locToBlock().
| Chunk org.bukkit.Location.getChunk | ( | ) |
Gets the chunk at the represented location.
Definition at line 72 of file Location.java.
References org.bukkit.World.getChunkAt().
| Vector org.bukkit.Location.getDirection | ( | ) |
Gets a Vector pointing in the direction that this Location is facing.
Definition at line 210 of file Location.java.
References org.bukkit.Location.getPitch(), org.bukkit.Location.getYaw(), org.bukkit.util.Vector.setX(), org.bukkit.util.Vector.setY(), and org.bukkit.util.Vector.setZ().
Referenced by org.bukkit.util.BlockIterator.BlockIterator().
| float org.bukkit.Location.getPitch | ( | ) |
Gets the pitch of this location.
Definition at line 201 of file Location.java.
Referenced by org.bukkit.Location.getDirection().
| World org.bukkit.Location.getWorld | ( | ) |
Gets the world that this location resides in.
Definition at line 63 of file Location.java.
Referenced by org.bukkit.Location.add(), org.bukkit.util.BlockIterator.BlockIterator(), org.bukkit.Location.distanceSquared(), org.bukkit.event.player.PlayerRespawnEvent.setRespawnLocation(), org.bukkit.event.world.StructureGrowEvent.StructureGrowEvent(), and org.bukkit.Location.subtract().
| double org.bukkit.Location.getX | ( | ) |
Gets the x-coordinate of this location.
Definition at line 99 of file Location.java.
Referenced by org.bukkit.command.defaults.SpawnpointCommand.execute(), and org.bukkit.command.defaults.TeleportCommand.execute().
| double org.bukkit.Location.getY | ( | ) |
Gets the y-coordinate of this location.
Definition at line 127 of file Location.java.
Referenced by org.bukkit.command.defaults.SpawnpointCommand.execute(), and org.bukkit.command.defaults.TeleportCommand.execute().
| float org.bukkit.Location.getYaw | ( | ) |
Gets the yaw of this location.
Definition at line 183 of file Location.java.
Referenced by org.bukkit.Location.getDirection().
| double org.bukkit.Location.getZ | ( | ) |
Gets the z-coordinate of this location.
Definition at line 155 of file Location.java.
Referenced by org.bukkit.command.defaults.SpawnpointCommand.execute(), and org.bukkit.command.defaults.TeleportCommand.execute().
| int org.bukkit.Location.hashCode | ( | ) |
Definition at line 447 of file Location.java.
| double org.bukkit.Location.length | ( | ) |
Gets the magnitude of the location, defined as sqrt(x^2+y^2+z^2).
The value of this method is not cached and uses a costly square-root function, so do not repeatedly call this method to get the location's magnitude. NaN will be returned if the inner result of the sqrt() function overflows, which will be caused if the length is too long. Not world-aware and orientation independent.
Definition at line 336 of file Location.java.
| double org.bukkit.Location.lengthSquared | ( | ) |
Gets the magnitude of the location squared.
Not world-aware and orientation independent.
Definition at line 347 of file Location.java.
|
static |
Safely converts a double (location coordinate) to an int (block coordinate)
| loc | Precise coordinate |
Definition at line 488 of file Location.java.
References org.bukkit.util.NumberConversions.floor().
Referenced by org.bukkit.Location.getBlockX(), org.bukkit.Location.getBlockY(), and org.bukkit.Location.getBlockZ().
| Location org.bukkit.Location.multiply | ( | double | m | ) |
Performs scalar multiplication, multiplying all components with a scalar.
Not world-aware.
| m | The factor |
Definition at line 395 of file Location.java.
| void org.bukkit.Location.setPitch | ( | float | pitch | ) |
Sets the pitch of this location.
| pitch | New pitch |
Definition at line 192 of file Location.java.
| void org.bukkit.Location.setWorld | ( | World | world | ) |
Sets the world that this location resides in.
| world | New world that this location resides in |
Definition at line 54 of file Location.java.
| void org.bukkit.Location.setX | ( | double | x | ) |
Sets the x-coordinate of this location.
| x | X-coordinate |
Definition at line 90 of file Location.java.
Referenced by org.bukkit.command.defaults.TeleportCommand.execute().
| void org.bukkit.Location.setY | ( | double | y | ) |
Sets the y-coordinate of this location.
| y | y-coordinate |
Definition at line 118 of file Location.java.
Referenced by org.bukkit.command.defaults.TeleportCommand.execute().
| void org.bukkit.Location.setYaw | ( | float | yaw | ) |
| void org.bukkit.Location.setZ | ( | double | z | ) |
Sets the z-coordinate of this location.
| z | z-coordinate |
Definition at line 146 of file Location.java.
Referenced by org.bukkit.command.defaults.TeleportCommand.execute().
Subtracts the location by another.
| vec | The other location |
| IllegalArgumentException | for differing worlds |
Definition at line 283 of file Location.java.
References org.bukkit.Location.getWorld().
Subtracts the location by a vector.
| vec | The vector to use |
Definition at line 301 of file Location.java.
References org.bukkit.util.Vector.getX(), org.bukkit.util.Vector.getY(), and org.bukkit.util.Vector.getZ().
| Location org.bukkit.Location.subtract | ( | double | x, |
| double | y, | ||
| double | z | ||
| ) |
Subtracts the location by another.
Not world-aware and orientation independent.
| x | X coordinate |
| y | Y coordinate |
| z | Z coordinate |
Definition at line 318 of file Location.java.
| String org.bukkit.Location.toString | ( | ) |
Definition at line 460 of file Location.java.
| Vector org.bukkit.Location.toVector | ( | ) |
Constructs a new Vector based on this Location.
Definition at line 469 of file Location.java.
Referenced by org.bukkit.util.BlockIterator.BlockIterator().
| Location org.bukkit.Location.zero | ( | ) |
Zero this location's components.
Not world-aware.
Definition at line 408 of file Location.java.