Package kr.toxicity.library.dynamicuv
Record Class ElementVector
java.lang.Object
java.lang.Record
kr.toxicity.library.dynamicuv.ElementVector
- Record Components:
x- the x coordinatey- the y coordinatez- the z coordinate
Represents a 3D vector for elements.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionElementVector(float x, float y, float z) Creates an instance of aElementVectorrecord class. -
Method Summary
Modifier and TypeMethodDescription@NotNull com.google.gson.JsonArrayasJson()Converts the vector to a JSON array.@NotNull ElementVectordiv(float scala) Divides the vector coordinates by the given scalar.@NotNull ElementVectordiv(float x, float y, float z) Divides the vector coordinates by the given divisors.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@NotNull ElementVectorinflate(float inflate) Inflates the vector by the given amount.static @NotNull ElementVectormax(@NotNull ElementVector from, @NotNull ElementVector to) Returns a vector with the maximum coordinates of the two given vectors.static @NotNull ElementVectormin(@NotNull ElementVector from, @NotNull ElementVector to) Returns a vector with the minimum coordinates of the two given vectors.@NotNull ElementVectorminus(float x, float y, float z) Subtracts the given coordinates from this vector.@NotNull ElementVectorminus(@NotNull ElementVector vector) Subtracts the given vector from this vector.@NotNull ElementVectormul(float scala) Multiplies the vector coordinates by the given scalar.@NotNull ElementVectormul(float x, float y, float z) Multiplies the vector coordinates by the given factors.@NotNull ElementVectorplus(float x, float y, float z) Adds the given coordinates to this vector.@NotNull ElementVectorplus(@NotNull ElementVector vector) Adds the given vector to this vector.@NotNull ElementVectorConverts this vector to model location (multiplies by 16).final StringtoString()Returns a string representation of this record class.floatx()Returns the value of thexrecord component.@NotNull ElementVectorxy()Returns a new vector with only the X and Y components (Z is 0).@NotNull ElementVectorxz()Returns a new vector with only the X and Z components (Y is 0).floaty()Returns the value of theyrecord component.floatz()Returns the value of thezrecord component.@NotNull ElementVectorzy()Returns a new vector with only the Z and Y components (X is 0).
-
Field Details
-
CENTER
The center vector (8, 8, 8).
-
-
Constructor Details
-
Method Details
-
min
@NotNull public static @NotNull ElementVector min(@NotNull @NotNull ElementVector from, @NotNull @NotNull ElementVector to) Returns a vector with the minimum coordinates of the two given vectors.- Parameters:
from- the first vectorto- the second vector- Returns:
- the vector with minimum coordinates
-
max
@NotNull public static @NotNull ElementVector max(@NotNull @NotNull ElementVector from, @NotNull @NotNull ElementVector to) Returns a vector with the maximum coordinates of the two given vectors.- Parameters:
from- the first vectorto- the second vector- Returns:
- the vector with maximum coordinates
-
plus
Adds the given coordinates to this vector.- Parameters:
x- the x coordinate to addy- the y coordinate to addz- the z coordinate to add- Returns:
- the resulting vector
-
plus
Adds the given vector to this vector.- Parameters:
vector- the vector to add- Returns:
- the resulting vector
-
minus
Subtracts the given coordinates from this vector.- Parameters:
x- the x coordinate to subtracty- the y coordinate to subtractz- the z coordinate to subtract- Returns:
- the resulting vector
-
minus
Subtracts the given vector from this vector.- Parameters:
vector- the vector to subtract- Returns:
- the resulting vector
-
toModelLocation
Converts this vector to model location (multiplies by 16).- Returns:
- the resulting vector
-
inflate
Inflates the vector by the given amount.- Parameters:
inflate- the amount to inflate- Returns:
- the resulting vector
-
mul
Multiplies the vector coordinates by the given factors.- Parameters:
x- the x factory- the y factorz- the z factor- Returns:
- the resulting vector
-
div
Divides the vector coordinates by the given divisors.- Parameters:
x- the x divisory- the y divisorz- the z divisor- Returns:
- the resulting vector
-
mul
Multiplies the vector coordinates by the given scalar.- Parameters:
scala- the scalar- Returns:
- the resulting vector
-
div
Divides the vector coordinates by the given scalar.- Parameters:
scala- the scalar- Returns:
- the resulting vector
-
asJson
@NotNull public @NotNull com.google.gson.JsonArray asJson()Converts the vector to a JSON array.- Returns:
- the JSON array
-
xz
Returns a new vector with only the X and Z components (Y is 0).- Returns:
- the XZ vector
-
xy
Returns a new vector with only the X and Y components (Z is 0).- Returns:
- the XY vector
-
zy
Returns a new vector with only the Z and Y components (X is 0).- Returns:
- the ZY vector
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
x
public float x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
public float y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-
z
public float z()Returns the value of thezrecord component.- Returns:
- the value of the
zrecord component
-