diff --git a/paper-api/src/main/java/org/bukkit/util/Vector.java b/paper-api/src/main/java/org/bukkit/util/Vector.java index b98568f1a9..4607b15f3c 100644 --- a/paper-api/src/main/java/org/bukkit/util/Vector.java +++ b/paper-api/src/main/java/org/bukkit/util/Vector.java @@ -12,8 +12,11 @@ import org.bukkit.configuration.serialization.SerializableAs; import org.jetbrains.annotations.NotNull; import org.joml.RoundingMode; import org.joml.Vector3d; +import org.joml.Vector3dc; import org.joml.Vector3f; +import org.joml.Vector3fc; import org.joml.Vector3i; +import org.joml.Vector3ic; /** * Represents a mutable vector. Because the components of Vectors are mutable, @@ -948,6 +951,39 @@ public class Vector implements Cloneable, ConfigurationSerializable { return new Vector(vector.x(), vector.y(), vector.z()); } + /** + * Gets a vector with components that match the provided JOML {@link Vector3fc}. + * + * @param vector the vector to match + * @return the new vector + */ + @NotNull + public static Vector fromJOML(@NotNull Vector3fc vector) { + return new Vector(vector.x(), vector.y(), vector.z()); + } + + /** + * Gets a vector with components that match the provided JOML {@link Vector3dc}. + * + * @param vector the vector to match + * @return the new vector + */ + @NotNull + public static Vector fromJOML(@NotNull Vector3dc vector) { + return new Vector(vector.x(), vector.y(), vector.z()); + } + + /** + * Gets a vector with components that match the provided JOML {@link Vector3ic}. + * + * @param vector the vector to match + * @return the new vector + */ + @NotNull + public static Vector fromJOML(@NotNull Vector3ic vector) { + return new Vector(vector.x(), vector.y(), vector.z()); + } + @Override @NotNull public Map serialize() {