Package net.minecraft.world.phys
Class Vec3
java.lang.Object
net.minecraft.world.phys.Vec3
- All Implemented Interfaces:
Position
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd
(double x, double y, double z) Adds the specified x,y,z vector components to this vector and returns the resulting vector.align
(EnumSet<Direction.Axis> axes) static Vec3
atBottomCenterOf
(Vec3i toCopy) Copies the coordinates of an int vector and centers them horizontally (x and z)static Vec3
atCenterOf
(Vec3i toCopy) Copies the coordinates of an Int vector and centers them.static Vec3
atLowerCornerOf
(Vec3i toCopy) Copies the coordinates of an int vector exactly.static Vec3
atLowerCornerWithOffset
(Vec3i toCopy, double offsetX, double offsetY, double offsetZ) boolean
closerThan
(Position pos, double distance) Checks if a position is within a certain distance of the coordinates.boolean
closerThan
(Vec3 pos, double horizontalDistance, double verticalDistance) Returns a new vector with the result of this vector x the specified vector.static Vec3
directionFromRotation
(float pitch, float yaw) Returns aVec3
from the given pitch and yaw degrees.static Vec3
double
distanceTo
(Vec3 vec) Euclidean distance between this and the specified vector, returned as double.double
distanceToSqr
(double x, double y, double z) double
distanceToSqr
(Vec3 vec) The square of the Euclidean distance between this and the specified vector.double
boolean
static Vec3
fromRGB24
(int packed) double
get
(Direction.Axis axis) int
hashCode()
double
double
double
length()
double
Lerps between this vector and the given vector.multiply
(double factorX, double factorY, double factorZ) offsetRandom
(RandomSource random, float factor) reverse()
scale
(double factor) subtract
(double x, double y, double z) toString()
org.joml.Vector3f
static Vec3
upFromBottomCenterOf
(Vec3i toCopy, double verticalOffset) Copies the coordinates of an int vector and centers them horizontally and applies a vertical offset.Returns a new vector with the result of the specified vector minus this.with
(Direction.Axis axis, double length) final double
x()
xRot
(float pitch) final double
y()
yRot
(float yaw) final double
z()
zRot
(float roll)
-
Field Details
-
CODEC
-
ZERO
-
x
public final double x -
y
public final double y -
z
public final double z
-
-
Constructor Details
-
Vec3
public Vec3(double x, double y, double z) -
Vec3
public Vec3(org.joml.Vector3f vector)
-
-
Method Details
-
fromRGB24
-
atLowerCornerOf
Copies the coordinates of an int vector exactly. -
atLowerCornerWithOffset
-
atCenterOf
Copies the coordinates of an Int vector and centers them. -
atBottomCenterOf
Copies the coordinates of an int vector and centers them horizontally (x and z) -
upFromBottomCenterOf
Copies the coordinates of an int vector and centers them horizontally and applies a vertical offset. -
vectorTo
Returns a new vector with the result of the specified vector minus this. -
normalize
-
dot
-
cross
Returns a new vector with the result of this vector x the specified vector. -
subtract
-
subtract
-
add
-
add
Adds the specified x,y,z vector components to this vector and returns the resulting vector. Does not change this vector. -
closerThan
Checks if a position is within a certain distance of the coordinates. -
distanceTo
Euclidean distance between this and the specified vector, returned as double. -
distanceToSqr
The square of the Euclidean distance between this and the specified vector. -
distanceToSqr
public double distanceToSqr(double x, double y, double z) -
closerThan
-
scale
-
reverse
-
multiply
-
multiply
-
offsetRandom
-
length
public double length() -
lengthSqr
public double lengthSqr() -
horizontalDistance
public double horizontalDistance() -
horizontalDistanceSqr
public double horizontalDistanceSqr() -
equals
-
hashCode
public int hashCode() -
toString
-
lerp
Lerps between this vector and the given vector.- See Also:
-
xRot
-
yRot
-
zRot
-
directionFromRotation
-
directionFromRotation
Returns aVec3
from the given pitch and yaw degrees. -
align
-
get
-
with
-
relative
-
x
public final double x() -
y
public final double y() -
z
public final double z() -
toVector3f
public org.joml.Vector3f toVector3f()
-