mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-20 07:02:32 +01:00
Add block position conversion
This commit is contained in:
parent
602472fc65
commit
43ac1c53e3
@ -87,6 +87,13 @@ public interface Vec {
|
||||
return new Pos(x(), y(), z());
|
||||
}
|
||||
|
||||
default @NotNull Vec asBlockPosition() {
|
||||
final int castedY = (int) y();
|
||||
return with((int) Math.floor(x()),
|
||||
(y() == castedY) ? castedY : castedY + 1,
|
||||
(int) Math.floor(z()));
|
||||
}
|
||||
|
||||
@Contract(pure = true)
|
||||
double x();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user