A 3-dimensional vector, in a 3-dimensional vector space.

This class is immutable, meaning its values cannot change, so it is safe to be stored as a key in maps or in collections.

No, it's not an arrow.

Импорт класса

Link to импорт-класса

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

ZenScript
Copy
import crafttweaker.api.util.MCVector3d;

Implemented Interfaces

Link to implemented-interfaces

MCVector3d implements the following interfaces. That means all methods defined in these interfaces are also available in MCVector3d

ZenScript
Copy
new MCVector3d(x as double, y as double, z as double) as MCVector3d
ПараметрТипОписание
Параметр
x
Тип
double
Описание
Описание отсутствует
Параметр
y
Тип
double
Описание
Описание отсутствует
Параметр
z
Тип
double
Описание
Описание отсутствует
Тип результатаЯвляется неявным
Тип результата
MCVector3i
Является неявным
false

Name: asVector3i

Return Type: MCVector3i

ZenScript
Copy
// MCVector3d.asVector3i() as MCVector3i

myMCVector3d.asVector3i();

Name: cross

Performs the cross product between this vector and other.

Returns: The cross product.
Return Type: MCVector3d

ZenScript
Copy
MCVector3d.cross(other as MCVector3d) as MCVector3d
ПараметрТипОписание
Параметр
other
Тип
MCVector3d
Описание
The other vector.

Name: distanceTo

Computes the Euclidean distance between this vector and the other vector.

Returns: The Euclidean distance between them.
Return Type: double

ZenScript
Copy
MCVector3d.distanceTo(other as MCVector3d) as double
ПараметрТипОписание
Параметр
other
Тип
MCVector3d
Описание
The other vector.

Name: dot

Performs a dot product between this vector and other.

Returns: The dot product.
Return Type: double

ZenScript
Copy
MCVector3d.dot(other as MCVector3d) as double
ПараметрТипОписание
Параметр
other
Тип
MCVector3d
Описание
The other vector.

Name: getCoordinate

Gets the coordinate of this vector that corresponds to the given DirectionAxis.

Returns: The value of the corresponding coordinate.
Return Type: double

ZenScript
Copy
MCVector3d.getCoordinate(axis as DirectionAxis) as double
ПараметрТипОписание
Параметр
axis
Тип
DirectionAxis
Описание
The axis.

Name: getCoordinate

Gets the coordinate of this vector identified by the specified index.

Namely, 0 corresponds to the X coordinate, 1 to Y, and 2 to Z.

Returns: The value of the corresponding coordinate.
Return Type: double

ZenScript
Copy
MCVector3d.getCoordinate(index as int) as double
ПараметрТипОписание
Параметр
index
Тип
int
Описание
The coordinate index.

Name: minus

Subtracts other from this vector.

Returns: The subtraction result.
Return Type: MCVector3d

ZenScript
Copy
MCVector3d.minus(other as MCVector3d) as MCVector3d
ПараметрТипОписание
Параметр
other
Тип
MCVector3d
Описание
The other vector.

Name: minus

Subtracts the vector (x, y, z) from this vector.

Returns: The subtraction result.
Return Type: MCVector3d

ZenScript
Copy
MCVector3d.minus(x as double, y as double, z as double) as MCVector3d
ПараметрТипОписание
Параметр
x
Тип
double
Описание
The x component of the other vector.
Параметр
y
Тип
double
Описание
The y component of the other vector.
Параметр
z
Тип
double
Описание
The z component of the other vector.

Name: normalize

Normalizes the current vector, making it of unit length.

Returns: The normalized vector.
Return Type: MCVector3d

ZenScript
Copy
// MCVector3d.normalize() as MCVector3d

myMCVector3d.normalize();

Name: plus

Adds this vector to the other vector, computing their sum member by member.

Returns: The sum.
Return Type: MCVector3d

ZenScript
Copy
MCVector3d.plus(other as MCVector3d) as MCVector3d
ПараметрТипОписание
Параметр
other
Тип
MCVector3d
Описание
The other vector.

Name: plus

Adds this vector to the vector (x, y, z), computing their sum member by member.

Returns: The sum.
Return Type: MCVector3d

ZenScript
Copy
MCVector3d.plus(x as double, y as double, z as double) as MCVector3d
ПараметрТипОписание
Параметр
x
Тип
double
Описание
The x component of the other vector.
Параметр
y
Тип
double
Описание
The y component of the other vector.
Параметр
z
Тип
double
Описание
The z component of the other vector.

Name: scale

Scales the current vector by the given factor.

Returns: The scaled vector.
Return Type: MCVector3d

ZenScript
Copy
MCVector3d.scale(factor as double) as MCVector3d
ПараметрТипОписание
Параметр
factor
Тип
double
Описание
The factor.

Link to squareDistanceTo

Name: squareDistanceTo

Computes the squared Euclidean distance between this vector and the other vector.

This method is faster and less error-prone than calling distanceTo and squaring the result.

Returns: The squared Euclidean distance between them.
Return Type: double

ZenScript
Copy
MCVector3d.squareDistanceTo(other as MCVector3d) as double
ПараметрТипОписание
Параметр
other
Тип
MCVector3d
Описание
The other vector.

Name: subtractReverse

Subtracts this vector from the other vector and returns the result.

Returns: The result.
Return Type: MCVector3d

ZenScript
Copy
MCVector3d.subtractReverse(other as MCVector3d) as MCVector3d
ПараметрТипОписание
Параметр
other
Тип
MCVector3d
Описание
The vector from which this vector should be subtracted from.

Name: times

Multiplies the two vectors member by member, computing what is known as the Hadamard product.

Returns: The Hadamard product.
Return Type: MCVector3d

ZenScript
Copy
MCVector3d.times(other as MCVector3d) as MCVector3d
ПараметрТипОписание
Параметр
other
Тип
MCVector3d
Описание
The other vector.

Name: times

Multiplies this vector with the vector (x, y, z), computing what is known as the Hadamard product.

Returns: The Hadamard product.
Return Type: MCVector3d

ZenScript
Copy
MCVector3d.times(x as double, y as double, z as double) as MCVector3d
ПараметрТипОписание
Параметр
x
Тип
double
Описание
The x component of the other vector.
Параметр
y
Тип
double
Описание
The y component of the other vector.
Параметр
z
Тип
double
Описание
The z component of the other vector.

Свойства

Link to свойства

НазваниеТипИмеет GetterИмеет SetterОписание
Название
inverse
Тип
MCVector3d
Имеет Getter
true
Имеет Setter
false
Описание
Inverts the vector, effectively flipping it.

This is equivalent to a scale by -1, or a rotation of pi radians around the origin.
Название
magnitude
Тип
double
Имеет Getter
true
Имеет Setter
false
Описание
Gets the length, also known as magnitude, of the vector.
Название
magnitudeSquared
Тип
double
Имеет Getter
true
Имеет Setter
false
Описание
Gets the squared length, also known as squared magnitude, of the vector.

This method is faster and less error-prone than calling magnitude and squaring the result.
Название
x
Тип
double
Имеет Getter
true
Имеет Setter
false
Описание
Gets the X coordinate of this vector.
Название
y
Тип
double
Имеет Getter
true
Имеет Setter
false
Описание
Gets the Y coordinate of this vector.
Название
z
Тип
double
Имеет Getter
true
Имеет Setter
false
Описание
Gets the Z coordinate of this vector.