mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-06 16:37:38 +01:00
Add Vec#fromPoint
This commit is contained in:
parent
a9e78d5583
commit
96c7fc9147
@ -53,6 +53,19 @@ public final class Vec implements Point {
|
|||||||
this(value, value, value);
|
this(value, value, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a {@link Point} into a {@link Vec}.
|
||||||
|
* Will cast if possible, or instantiate a new object.
|
||||||
|
*
|
||||||
|
* @param point the point to convert
|
||||||
|
* @return the converted vector
|
||||||
|
*/
|
||||||
|
public static @NotNull Vec fromPoint(@NotNull Point point) {
|
||||||
|
if (point instanceof Vec)
|
||||||
|
return (Vec) point;
|
||||||
|
return new Vec(point.x(), point.y(), point.z());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new point with coordinated depending on {@code this}.
|
* Creates a new point with coordinated depending on {@code this}.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user