mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-21 06:41:43 +01:00
Allow offsetting the BoundingBox
This commit is contained in:
parent
b58db7d5b0
commit
49a4226ebb
@ -25,7 +25,7 @@ public final class BoundingBox implements Shape {
|
|||||||
private final Point offset;
|
private final Point offset;
|
||||||
private Point relativeEnd;
|
private Point relativeEnd;
|
||||||
|
|
||||||
BoundingBox(double width, double height, double depth, Point offset) {
|
public BoundingBox(double width, double height, double depth, Point offset) {
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
this.depth = depth;
|
this.depth = depth;
|
||||||
@ -125,6 +125,16 @@ public final class BoundingBox implements Shape {
|
|||||||
return new BoundingBox(this.width - x, this.height - y, this.depth - z);
|
return new BoundingBox(this.width - x, this.height - y, this.depth - z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@link BoundingBox} linked to the same {@link Entity} with an offset.
|
||||||
|
*
|
||||||
|
* @param offset the offset
|
||||||
|
* @return a new bounding box with an offset.
|
||||||
|
*/
|
||||||
|
public @NotNull BoundingBox offset(Point offset) {
|
||||||
|
return new BoundingBox(this.width, this.height, this.depth, offset);
|
||||||
|
}
|
||||||
|
|
||||||
public double width() {
|
public double width() {
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user