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 Vec3atBottomCenterOf(Vec3i toCopy) Copies the coordinates of an int vector and centers them horizontally (x and z)static Vec3atCenterOf(Vec3i toCopy) Copies the coordinates of an Int vector and centers them.static Vec3atLowerCornerOf(Vec3i toCopy) Copies the coordinates of an int vector exactly.static Vec3atLowerCornerWithOffset(Vec3i toCopy, double offsetX, double offsetY, double offsetZ) booleancloserThan(Position pos, double distance) Checks if a position is within a certain distance of the coordinates.booleancloserThan(Vec3 pos, double horizontalDistance, double verticalDistance) Returns a new vector with the result of this vector x the specified vector.static Vec3directionFromRotation(float pitch, float yaw) Returns aVec3from the given pitch and yaw degrees.static Vec3doubledistanceTo(Vec3 vec) Euclidean distance between this and the specified vector, returned as double.doubledistanceToSqr(double x, double y, double z) doubledistanceToSqr(Vec3 vec) The square of the Euclidean distance between this and the specified vector.doublebooleanstatic Vec3fromRGB24(int packed) doubleget(Direction.Axis axis) inthashCode()doubledoubledoublelength()doubleLerps 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.Vector3fstatic Vec3upFromBottomCenterOf(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 doublex()xRot(float pitch) final doubley()yRot(float yaw) final doublez()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 aVec3from 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()
-