Package net.minecraft.world.phys
Class Vec3
java.lang.Object
net.minecraft.world.phys.Vec3
- All Implemented Interfaces:
Position
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<Vec3> static final StreamCodec<io.netty.buffer.ByteBuf, Vec3> final doublefinal doublefinal doublestatic final Vec3 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(double pAmount) add(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 Vec3atBottomCenterOf(Vec3i pToCopy) Copies the coordinates of an int vector and centers them horizontally (x and z)static Vec3atCenterOf(Vec3i pToCopy) Copies the coordinates of an Int vector and centers them.static Vec3atLowerCornerOf(Vec3i pToCopy) Copies the coordinates of an int vector exactly.static Vec3atLowerCornerWithOffset(Vec3i pToCopy, double pOffsetX, double pOffsetY, double pOffsetZ) booleancloserThan(Position pPos, double pDistance) Checks if a position is within a certain distance of the coordinates.booleancloserThan(Vec3 pPos, double pHorizontalDistance, double pVerticalDistance) Returns a new vector with the result of this vector x the specified vector.static Vec3directionFromRotation(float pPitch, float pYaw) Returns aVec3from the given pitch and yaw degrees.static Vec3directionFromRotation(Vec2 pVec) doubledistanceTo(Vec3 pVec) Euclidean distance between this and the specified vector, returned as double.doubledistanceToSqr(double pX, double pY, double pZ) doubledistanceToSqr(Vec3 pVec) The square of the Euclidean distance between this and the specified vector.doublebooleanstatic Vec3fromRGB24(int pPacked) doubleget(Direction.Axis pAxis) inthashCode()doubledoubledoublelength()doubleLerps between this vector and the given vector.multiply(double pFactorX, double pFactorY, double pFactorZ) offsetRandom(RandomSource pRandom, float pFactor) projectedOn(Vec3 pVector) reverse()scale(double pFactor) subtract(double pAmount) subtract(double pX, double pY, double pZ) toString()static Vec3upFromBottomCenterOf(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 doublex()xRot(float pPitch) final doubley()yRot(float pYaw) final doublez()zRot(float pRoll)
-
Field Details
-
CODEC
-
STREAM_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
-
Vec3
-
-
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
-
subtract
-
add
-
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
-
horizontal
-
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
-
projectedOn
-