|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.quartercode.quarterbukkit.api.Cuboid
public class Cuboid
This class represents a cuboid between to different locations saved as Vector
s.
The cuboid can't get modified after construction, so it's final. You can only read values in different ways.
All constructors delivers their cooridnates to Cuboid(double, double, double, double, double, double)
which sorts them to a larger and a smaller Vector
. This will lose the original
locations, but you can work better with the data later on.
getVector1()
returns the larger one, getVector2()
the smaller one. You can also read those values by using the getXXX1()
and getXXX2()
methods.
Here's an example how the sorting works: We have two locations with the coordinates 5, 10, 7
and 12, 6, 18
, the Vector
s will be the larger one 12, 10, 18
and the
smaller one 5, 6, 7
.
Constructor Summary | |
---|---|
Cuboid(double x1,
double y1,
double z1,
double x2,
double y2,
double z2)
Creates a new cuboid out of two locations given by six doubles, three for each location. |
|
Cuboid(org.bukkit.Location location1,
org.bukkit.Location location2)
Creates a new cuboid out of two locations given by two Location s. |
|
Cuboid(org.bukkit.util.Vector vector1,
org.bukkit.util.Vector vector2)
Creates a new cuboid out of two locations given by two Vector s. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
|
org.bukkit.util.Vector |
getBlockCenter()
This method returns the center position of the cuboid as a block location by subtracting the half of every distance from every larger coordinate and calculating the block location of every result coordinate. |
java.util.List<org.bukkit.util.Vector> |
getBlocks()
This method returns a list of all blocks which are located in the cuboid as a list of Vector s. |
int |
getBlockX1()
This method returns the larger x-coordinate of both locations as a block location. |
int |
getBlockX2()
This method returns the smaller x-coordinate of both locations as a block location. |
double |
getBlockXDistance()
This method returns the distance between the two x-block-coordinates (you can use this to get the distance between the two x-walls as a block-value) by subtracting the smaller from the larger one and round. |
int |
getBlockY1()
This method returns the larger y-coordinate of both locations as a block location. |
int |
getBlockY2()
This method returns the smaller y-coordinate of both locations as a block location. |
double |
getBlockYDistance()
This method returns the distance between the two y-block-coordinates (you can use this to get the distance between the two y-walls as a block-value) by subtracting the smaller from the larger one and round. |
int |
getBlockZ1()
This method returns the larger z-coordinate of both locations as a block location. |
int |
getBlockZ2()
This method returns the smaller z-coordinate of both locations as a block location. |
double |
getBlockZDistance()
This method returns the distance between the two z-block-coordinates (you can use this to get the distance between the two z-walls as a block-value) by subtracting the smaller from the larger one and round. |
org.bukkit.util.Vector |
getCenter()
This method returns the center position of the cuboid by subtracting the half of every distance from every larger coordinate. |
org.bukkit.util.Vector |
getVector1()
This method returns the first cuboid Vector with the larger coordinates. |
org.bukkit.util.Vector |
getVector2()
This method returns the second cuboid Vector with the smaller coordinates. |
double |
getX1()
This method returns the larger x-coordinate of both locations. |
double |
getX2()
This method returns the smaller x-coordinate of both locations. |
double |
getXDistance()
This method returns the distance between the two x-coordinates (you can use this to get the distance between the two x-walls) by subtracting the smaller from the larger one. |
double |
getY1()
This method returns the larger y-coordinate of both locations. |
double |
getY2()
This method returns the smaller y-coordinate of both locations. |
double |
getYDistance()
This method returns the distance between the two y-coordinates (you can use this to get the distance between the two y-walls) by subtracting the smaller from the larger one. |
double |
getZ1()
This method returns the larger z-coordinate of both locations. |
double |
getZ2()
This method returns the smaller z-coordinate of both locations. |
double |
getZDistance()
This method returns the distance between the two z-coordinates (you can use this to get the distance between the two z-walls) by subtracting the smaller from the larger one. |
int |
hashCode()
|
boolean |
intersects(double x,
double y,
double z)
This method checks if an other location actually intersects with the cuboid. |
boolean |
intersects(org.bukkit.Location location)
This method checks if an other location actually intersects with the cuboid. |
boolean |
intersects(org.bukkit.util.Vector vector)
This method checks if an other location actually intersects with the cuboid. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Cuboid(double x1, double y1, double z1, double x2, double y2, double z2)
Creates a new cuboid out of two locations given by six doubles, three for each location.
This constructor sorts the coordinates to a larger and a smaller Vector
. The larger one contains all the larger values, the smaller one contains all coordinates with the smaller values.
This will lose the original locations, but you can work better with the data later on.
Here's an example how the sorting works: We have two locations with the coordinates 5, 10, 7
and 12, 6, 18
, the Vector
s will be the larger one 12, 10, 18
and the
smaller one 5, 6, 7
.
x1
- The x-coordinate for the first location.y1
- The y-coordinate for the first location.z1
- The z-coordinate for the first location.x2
- The x-coordinate for the second location.y2
- The y-coordinate for the second location.z2
- The z-coordinate for the second location,public Cuboid(org.bukkit.util.Vector vector1, org.bukkit.util.Vector vector2)
Creates a new cuboid out of two locations given by two Vector
s.
This constructor sorts the coordinates to a larger and a smaller Vector
. The larger one contains all the larger values, the smaller one contains all coordinates with the smaller values.
This will lose the original locations, but you can work better with the data later on.
Here's an example how the sorting works: We have two locations with the coordinates 5, 10, 7
and 12, 6, 18
, the Vector
s will be the larger one 12, 10, 18
and the
smaller one 5, 6, 7
.
vector1
- The Vector
for the first location.vector2
- The Vector
for the second location.public Cuboid(org.bukkit.Location location1, org.bukkit.Location location2)
Creates a new cuboid out of two locations given by two Location
s.
This constructor sorts the coordinates to a larger and a smaller Vector
. The larger one contains all the larger values, the smaller one contains all coordinates with the smaller values.
This will lose the original locations, but you can work better with the data later on.
Here's an example how the sorting works: We have two locations with the coordinates 5, 10, 7
and 12, 6, 18
, the Vector
s will be the larger one 12, 10, 18
and the
smaller one 5, 6, 7
.
location1
- The Location
for the first location.location2
- The Location
for the second location.Method Detail |
---|
public org.bukkit.util.Vector getVector1()
This method returns the first cuboid Vector
with the larger coordinates.
The save Vector
s aren't the input locations, the coordinates of both locations are sorted into one with the larger and one with the smaller ones. This will returns the one with the
larger values.
Vector
with the larger coordinates.public org.bukkit.util.Vector getVector2()
This method returns the second cuboid Vector
with the smaller coordinates.
The save Vector
s aren't the input locations, the coordinates of both locations are sorted into one with the larger and one with the smaller ones. This will returns the one with the
smaller values.
Vector
with the smaller coordinates.public double getX1()
This method returns the larger x-coordinate of both locations. You could also use the Vector.getX()
-method of the Vector
you're getting by getVector1()
.
The save Vector
s aren't the input locations, the coordinates of both locations are sorted into one with the larger and one with the smaller ones. This will returns the x-coordinate of
the one with the larger values.
public int getBlockX1()
This method returns the larger x-coordinate of both locations as a block location. You could also use the Vector.getBlockX()
-method of the Vector
you're getting by
getVector1()
.
The save Vector
s aren't the input locations, the coordinates of both locations are sorted into one with the larger and one with the smaller ones. This will returns the x-coordinate of
the one with the larger values as a block location.
public double getY1()
This method returns the larger y-coordinate of both locations. You could also use the Vector.getY()
-method of the Vector
you're getting by getVector1()
.
The save Vector
s aren't the input locations, the coordinates of both locations are sorted into one with the larger and one with the smaller ones. This will returns the y-coordinate of
the one with the larger values.
public int getBlockY1()
This method returns the larger y-coordinate of both locations as a block location. You could also use the Vector.getBlockY()
-method of the Vector
you're getting by
getVector1()
.
The save Vector
s aren't the input locations, the coordinates of both locations are sorted into one with the larger and one with the smaller ones. This will returns the y-coordinate of
the one with the larger values as a block location.
public double getZ1()
This method returns the larger z-coordinate of both locations. You could also use the Vector.getZ()
-method of the Vector
you're getting by getVector1()
.
The save Vector
s aren't the input locations, the coordinates of both locations are sorted into one with the larger and one with the smaller ones. This will returns the z-coordinate of
the one with the larger values.
public int getBlockZ1()
This method returns the larger z-coordinate of both locations as a block location. You could also use the Vector.getBlockZ()
-method of the Vector
you get by
getVector1()
.
The save Vector
s aren't the input locations, the coordinates of both locations are sorted into one with the larger and one with the smaller ones. This will returns the z-coordinate of
the one with the larger values as a block location.
public double getX2()
This method returns the smaller x-coordinate of both locations. You could also use the Vector.getX()
-method of the Vector
you're getting by getVector2()
.
The save Vector
s aren't the input locations, the coordinates of both locations are sorted into one with the larger and one with the smaller ones. This will returns the x-coordinate of
the one with the smaller values.
public int getBlockX2()
This method returns the smaller x-coordinate of both locations as a block location. You could also use the Vector.getBlockX()
-method of the Vector
you get by
getVector2()
.
The save Vector
s aren't the input locations, the coordinates of both locations are sorted into one with the larger and one with the smaller ones. This will returns the x-coordinate of
the one with the smaller values as a block location.
public double getY2()
This method returns the smaller y-coordinate of both locations. You could also use the Vector.getY()
-method of the Vector
you're getting by getVector2()
.
The save Vector
s aren't the input locations, the coordinates of both locations are sorted into one with the larger and one with the smaller ones. This will returns the y-coordinate of
the one with the smaller values.
public int getBlockY2()
This method returns the smaller y-coordinate of both locations as a block location. You could also use the Vector.getBlockY()
-method of the Vector
you get by
getVector2()
.
The save Vector
s aren't the input locations, the coordinates of both locations are sorted into one with the larger and one with the smaller ones. This will returns the y-coordinate of
the one with the smaller values as a block location.
public double getZ2()
This method returns the smaller z-coordinate of both locations. You could also use the Vector.getZ()
-method of the Vector
you're getting by getVector2()
.
The save Vector
s aren't the input locations, the coordinates of both locations are sorted into one with the larger and one with the smaller ones. This will returns the z-coordinate of
the one with the smaller values.
public int getBlockZ2()
This method returns the smaller z-coordinate of both locations as a block location. You could also use the Vector.getBlockX()
-method of the Vector
you get by
getVector2()
.
The save Vector
s aren't the input locations, the coordinates of both locations are sorted into one with the larger and one with the smaller ones. This will returns the z-coordinate of
the one with the smaller values as a block location.
public double getXDistance()
This method returns the distance between the two x-coordinates (you can use this to get the distance between the two x-walls) by subtracting the smaller from the larger one. This will always return a positive distance.
public double getBlockXDistance()
This method returns the distance between the two x-block-coordinates (you can use this to get the distance between the two x-walls as a block-value) by subtracting the smaller from the larger one and round. This will always return a positive distance.
public double getYDistance()
This method returns the distance between the two y-coordinates (you can use this to get the distance between the two y-walls) by subtracting the smaller from the larger one. This will always return a positive distance.
public double getBlockYDistance()
This method returns the distance between the two y-block-coordinates (you can use this to get the distance between the two y-walls as a block-value) by subtracting the smaller from the larger one and round. This will always return a positive distance.
public double getZDistance()
This method returns the distance between the two z-coordinates (you can use this to get the distance between the two z-walls) by subtracting the smaller from the larger one. This will always return a positive distance.
public double getBlockZDistance()
This method returns the distance between the two z-block-coordinates (you can use this to get the distance between the two z-walls as a block-value) by subtracting the smaller from the larger one and round. This will always return a positive distance.
public org.bukkit.util.Vector getCenter()
This method returns the center position of the cuboid by subtracting the half of every distance from every larger coordinate. You can use this to get the center of gravity of the cuboid.
public org.bukkit.util.Vector getBlockCenter()
This method returns the center position of the cuboid as a block location by subtracting the half of every distance from every larger coordinate and calculating the block location of every result coordinate. You can use this to get the center of gravity of the cuboid as a block location.
public boolean intersects(double x, double y, double z)
This method checks if an other location actually intersects with the cuboid. The location is given by three doubles representing the x-, y- and z-coordinate and returning the result as a boolean.
There will only be a positive result if all coordinates are intersecting the cuboid.
x
- The x-coordinate for checking if it's intersecting the cuboid.y
- The y-coordinate for checking if it's intersecting the cuboid.z
- The z-coordinate for checking if it's intersecting the cuboid.
public boolean intersects(org.bukkit.util.Vector vector)
This method checks if an other location actually intersects with the cuboid. The location is given by a Vector
and returning the result as a boolean.
There will only be a positive result if all coordinates of the Vector
are intersecting the cuboid.
vector
- The Vector
for checking if it's intersecting the cuboid.
public boolean intersects(org.bukkit.Location location)
This method checks if an other location actually intersects with the cuboid. The location is given by a Location
and returning the result as a boolean.
There will only be a positive result if all coordinates of the Location
are intersecting the cuboid.
location
- The Location
for checking if it's intersecting the cuboid.
public java.util.List<org.bukkit.util.Vector> getBlocks()
This method returns a list of all blocks which are located in the cuboid as a list of Vector
s.
You can iterate over the list and doing anything you want with the blocks like this:
for (Vector vector : getBlocks()) { vector.toLocation(world).getBlock()... }
Vector
s.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |