mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-09 21:29:11 +01:00
#949: Add Vector#fromJOML() overloads for read-only vector types
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
parent
b1ba1b1b8d
commit
9ce011cf3b
@ -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<String, Object> serialize() {
|
||||
|
Loading…
Reference in New Issue
Block a user