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 pX, double pY, double pZ) Adds the specified x,y,z vector components to this vector and returns the resulting vector.align
(EnumSet<Direction.Axis> pAxes) static Vec3
atBottomCenterOf
(Vec3i pToCopy) Copies the coordinates of an int vector and centers them horizontally (x and z)static Vec3
atCenterOf
(Vec3i pToCopy) Copies the coordinates of an Int vector and centers them.static Vec3
atLowerCornerOf
(Vec3i pToCopy) Copies the coordinates of an int vector exactly.static Vec3
atLowerCornerWithOffset
(Vec3i pToCopy, double pOffsetX, double pOffsetY, double pOffsetZ) boolean
closerThan
(Position pPos, double pDistance) Checks if a position is within a certain distance of the coordinates.boolean
closerThan
(Vec3 pPos, double pHorizontalDistance, double pVerticalDistance) Returns a new vector with the result of this vector x the specified vector.static Vec3
directionFromRotation
(float pPitch, float pYaw) Returns aVec3
from the given pitch and yaw degrees.static Vec3
directionFromRotation
(Vec2 pVec) double
distanceTo
(Vec3 pVec) Euclidean distance between this and the specified vector, returned as double.double
distanceToSqr
(double pX, double pY, double pZ) double
distanceToSqr
(Vec3 pVec) The square of the Euclidean distance between this and the specified vector.double
boolean
static Vec3
fromRGB24
(int pPacked) double
get
(Direction.Axis pAxis) int
hashCode()
double
double
double
length()
double
Lerps between this vector and the given vector.multiply
(double pFactorX, double pFactorY, double pFactorZ) offsetRandom
(RandomSource pRandom, float pFactor) reverse()
scale
(double pFactor) subtract
(double pX, double pY, double pZ) toString()
org.joml.Vector3f
static Vec3
upFromBottomCenterOf
(Vec3i pToCopy, double pVerticalOffset) 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 pAxis, double pLength) final double
x()
xRot
(float pPitch) final double
y()
yRot
(float pYaw) final double
z()
zRot
(float pRoll)
-
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 pX, double pY, double pZ) -
Vec3
public Vec3(org.joml.Vector3f p_253821_)
-
-
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 pX, double pY, double pZ) -
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()
-