mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-16 04:11:39 +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 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.height = height;
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
return width;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user