public class BoundingBox extends Object
Constructor and Description |
---|
BoundingBox(BoundingBox a,
BoundingBox b,
BiFunction<Double,Double,Double> f)
Create a new bounding box while computing two bounding box
|
BoundingBox(double minX,
double minY,
double minZ,
double maxX,
double maxY,
double maxZ) |
Modifier and Type | Method and Description |
---|---|
BoundingBox |
add(double x,
double y,
double z)
Create new bounding box with moved position
This doesn't change the size of box, just move it |
BoundingBox |
expand(double size)
Create new bounding box with expanded values
|
BoundingBox |
expand(double x,
double y,
double z)
Create new bounding box with expanded values
|
List<Point> |
getAllPoints() |
Point |
getAsHeadPoint()
Get head point where does the attack comes from
|
BlockChecker |
getBlocks(World w) |
double |
getDepth() |
double |
getHeight() |
Point |
getIntersectPoint(Player p)
Get intersection point between actual bounding box and the given player
|
Point |
getIntersectPoint(Point begin,
Vector dir)
Get intersection point between actual bounding box and given point/vector
|
Point |
getMax()
Get maximum position as point
|
double |
getMaxX()
Get maximum X
|
double |
getMaxY()
Get maximum Y
|
double |
getMaxZ()
Get maximum Z
|
Point |
getMid()
Get centered point (in X/Y/Z)
|
Point |
getMin()
Get minimum position as point
|
double |
getMinX()
Get minimum X
|
double |
getMinY()
Get minimum Y
|
double |
getMinZ()
Get minimum Z
|
Point |
getMostFarPoint(Point p) |
Point |
getNearestPoint(Point other) |
double |
getWidth() |
boolean |
isCollide(BoundingBox bb) |
boolean |
isIn(double x,
double y,
double z) |
boolean |
isIn(Point p) |
BoundingBox |
reduce(double size)
Create new bounding box with reduced values
|
BoundingBox |
reduce(double x,
double y,
double z)
Create new bounding box with reduced values
|
BoundingBox |
remove(double x,
double y,
double z)
Create new bounding box with moved position
This doesn't change the size of box, just move it |
String |
toString() |
public BoundingBox(double minX, double minY, double minZ, double maxX, double maxY, double maxZ)
public BoundingBox(BoundingBox a, BoundingBox b, BiFunction<Double,Double,Double> f)
a
- the first bounding boxb
- the second bounding boxf
- the function to know if we need min and max valuespublic double getMinX()
public double getMinY()
public double getMinZ()
public double getMaxX()
public double getMaxY()
public double getMaxZ()
public BoundingBox expand(double size)
size
- the size to addpublic BoundingBox expand(double x, double y, double z)
x
- the x value to addy
- the y value to addz
- the z value to addpublic BoundingBox reduce(double size)
size
- the size to removepublic BoundingBox reduce(double x, double y, double z)
x
- the x value to removey
- the y value to removez
- the z value to removepublic Point getMin()
public Point getMid()
public Point getMax()
public boolean isIn(Point p)
public boolean isCollide(BoundingBox bb)
public boolean isIn(double x, double y, double z)
public Point getAsHeadPoint()
public Point getIntersectPoint(Player p)
p
- player that attackpublic Point getIntersectPoint(Point begin, Vector dir)
begin
- the point where the attack comes fromdir
- the vector where entity was looking atpublic BlockChecker getBlocks(World w)
public double getWidth()
public double getHeight()
public double getDepth()
public BoundingBox add(double x, double y, double z)
x
- move in X axisy
- move in Y axisz
- move in Z axispublic BoundingBox remove(double x, double y, double z)
x
- move in X axisy
- move in Y axisz
- move in Z axis