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> static final StreamCodec<io.netty.buffer.ByteBuf, Vec3> final doublestatic final Vec3final doublestatic final Vec3final doublestatic final Vec3static final Vec3 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(double value) add(double x, double y, double z) Adds the specified x,y,z vector components to this vector and returns the resulting vector.addLocalCoordinates(Vec3 direction) align(EnumSet<Direction.Axis> axes) static Vec3applyLocalCoordinatesToRotation(Vec2 rotation, Vec3 direction) static Vec3atBottomCenterOf(Vec3i pos) Copies the coordinates of an int vector and centers them horizontally (x and z)static Vec3atCenterOf(Vec3i pos) Copies the coordinates of an Int vector and centers them.static Vec3atLowerCornerOf(Vec3i pos) Copies the coordinates of an int vector exactly.static Vec3atLowerCornerWithOffset(Vec3i pos, double x, double y, double z) booleancloserThan(Position pos, double distance) Checks if a position is within a certain distance of the coordinates.booleancloserThan(Vec3 vec, double distanceXZ, double distanceY) Returns a new vector with the result of this vector x the specified vector.static Vec3directionFromRotation(float rotX, float rotY) Returns aVec3from the given pitch and yaw degrees.static Vec3directionFromRotation(Vec2 rotation) doubledistanceTo(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.doublebooleandoubleget(Direction.Axis axis) inthashCode()doubledoublebooleanisFinite()doublelength()doubleLerps between this vector and the given vector.multiply(double xScale, double yScale, double zScale) offsetRandom(RandomSource random, float offset) offsetRandomXZ(RandomSource random, float offset) projectedOn(Vec3 onto) reverse()rotation()scale(double scale) subtract(double value) subtract(double x, double y, double z) toString()static Vec3upFromBottomCenterOf(Vec3i pos, double yOffset) 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 value) final doublex()xRot(float radians) final doubley()yRot(float radians) final doublez()zRot(float radians)
-
Field Details
-
CODEC
-
STREAM_CODEC
-
LP_STREAM_CODEC
-
ZERO
-
X_AXIS
-
Y_AXIS
-
Z_AXIS
-
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
-
Vec3
-
-
Method Details
-
atLowerCornerOf
-
atLowerCornerWithOffset
-
atCenterOf
-
atBottomCenterOf
-
upFromBottomCenterOf
-
vectorTo
-
normalize
-
dot
-
cross
-
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 x, double y, double z) -
closerThan
-
scale
-
reverse
-
multiply
-
multiply
-
horizontal
-
offsetRandom
-
offsetRandomXZ
-
length
public double length() -
lengthSqr
public double lengthSqr() -
horizontalDistance
public double horizontalDistance() -
horizontalDistanceSqr
public double horizontalDistanceSqr() -
equals
-
hashCode
-
toString
-
lerp
-
xRot
-
yRot
-
zRot
-
rotateClockwise90
-
directionFromRotation
-
directionFromRotation
-
rotation
-
align
-
get
-
with
-
relative
-
x
-
y
-
z
-
toVector3f
-
projectedOn
-
applyLocalCoordinatesToRotation
-
addLocalCoordinates
-
isFinite
public boolean isFinite()
-