Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMeinerLP committed May 23, 2024
2 parents 6a88fe6 + e9671a8 commit 39e898b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/net/minestom/server/collision/BoundingBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,12 @@ public boolean equals(Object o) {
default -> null;
};
}

public static @NotNull BoundingBox fromPoints(@NotNull Point a, @NotNull Point b) {
Vec aVec = Vec.fromPoint(a);
Vec min = aVec.min(b);
Vec max = aVec.max(b);
Vec dimensions = max.sub(min);
return new BoundingBox(dimensions.x(), dimensions.y(), dimensions.z(), min);
}
}

0 comments on commit 39e898b

Please sign in to comment.