mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-01 04:51:29 +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());
|
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)
|
@Contract(pure = true)
|
||||||
double x();
|
double x();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user