Class Vec3i
- All Implemented Interfaces:
 Comparable<Vec3i>
- Direct Known Subclasses:
 BlockPos,ChunkSectionPos
This class is very often used to hold the coordinates. To hold a block position
 specifically, use BlockPos instead, which extends Vec3i. To hold
 positions for entities and other non-voxels, consider using Vec3d that
 holds values using double instead.
 
Vec3i is read-only, but subclasses like BlockPos.Mutable
 may be mutable. Make sure to sanitize inputs of Vec3i if needed,
 such as calling BlockPos.toImmutable() or making new copies.
- See Also:
 - Mappings:
 Namespace Name named net/minecraft/util/math/Vec3iintermediary net/minecraft/class_2382official kg
- 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionadd(int x, int y, int z) Returns another Vec3i whose coordinates have the parameter x, y, and z added to the coordinates of this vector.Returns another Vec3i whose coordinates have the coordinates ofvecadded to the coordinates of this vector.intstatic com.mojang.serialization.Codec<Vec3i> createOffsetCodec(int maxAbsValue) crossProduct(Vec3i vec) down()Returns a vector which is offset by1in the downward direction.down(int distance) Returns a vector which is offset bydistancein the downward direction.east()Returns a vector which is offset by1in the eastward direction.east(int distance) Returns a vector which is offset bydistancein the eastward direction.booleanintReturns the Chebyshev distance between here andvec.intReturns the component on theaxisaxis.intReturns the Manhattan distance between here andvec.doublegetSquaredDistance(double x, double y, double z) Returns the squared distance between here and(x, y, z).doubleReturns the squared distance between here andpos.doublegetSquaredDistance(Vec3i vec) Returns the squared distance between here (center) andvec.doublegetSquaredDistanceFromCenter(double x, double y, double z) Returns the squared distance between the center of this voxel and(x, y, z).intgetX()intgetY()intgetZ()inthashCode()booleanisWithinDistance(Position pos, double distance) Returns whether the distance between here andposis less thandistance.booleanisWithinDistance(Vec3i vec, double distance) Returns whether the distance between here andvecis less thandistance.multiply(int scale) Returns a vector with all components multiplied byscale.north()Returns a vector which is offset by1in the northward direction.north(int distance) Returns a vector which is offset bydistancein the northward direction.Returns a vector which is offset by1indirectiondirection.offset(Direction.Axis axis, int distance) Returns a vector which is offset bydistanceonaxisaxis.Returns a vector which is offset bydistanceindirectiondirection.protected Vec3isetX(int x) protected Vec3isetY(int y) protected Vec3isetZ(int z) south()Returns a vector which is offset by1in the southward direction.south(int distance) Returns a vector which is offset bydistancein the southward direction.Returns another Vec3i whose coordinates have the coordinates ofvecsubtracted from the coordinates of this vector.Returns the coordinates joined with a colon and a space.toString()up()Returns a vector which is offset by1in the upward direction.up(int distance) Returns a vector which is offset bydistancein the upward direction.west()Returns a vector which is offset by1in the westward direction.west(int distance) Returns a vector which is offset bydistancein the westward direction. 
- 
Field Details
- 
CODEC
- Mappings:
 Namespace Name Mixin selector named CODECLnet/minecraft/util/math/Vec3i;CODEC:Lcom/mojang/serialization/Codec;intermediary field_25123Lnet/minecraft/class_2382;field_25123:Lcom/mojang/serialization/Codec;official gLkg;g:Lcom/mojang/serialization/Codec;
 - 
PACKET_CODEC
- Mappings:
 Namespace Name Mixin selector named PACKET_CODECLnet/minecraft/util/math/Vec3i;PACKET_CODEC:Lnet/minecraft/network/codec/PacketCodec;intermediary field_56131Lnet/minecraft/class_2382;field_56131:Lnet/minecraft/class_9139;official hLkg;h:Lzm;
 - 
ZERO
- Mappings:
 Namespace Name Mixin selector named ZEROLnet/minecraft/util/math/Vec3i;ZERO:Lnet/minecraft/util/math/Vec3i;intermediary field_11176Lnet/minecraft/class_2382;field_11176:Lnet/minecraft/class_2382;official iLkg;i:Lkg;
 - 
x
private int x- Mappings:
 Namespace Name Mixin selector named xLnet/minecraft/util/math/Vec3i;x:Iintermediary field_11175Lnet/minecraft/class_2382;field_11175:Iofficial aLkg;a:I
 - 
y
private int y- Mappings:
 Namespace Name Mixin selector named yLnet/minecraft/util/math/Vec3i;y:Iintermediary field_11174Lnet/minecraft/class_2382;field_11174:Iofficial bLkg;b:I
 - 
z
private int z- Mappings:
 Namespace Name Mixin selector named zLnet/minecraft/util/math/Vec3i;z:Iintermediary field_11173Lnet/minecraft/class_2382;field_11173:Iofficial cLkg;c:I
 
 - 
 - 
Constructor Details
- 
Vec3i
public Vec3i(int x, int y, int z) - Mappings:
 Namespace Name Mixin selector named <init>Lnet/minecraft/util/math/Vec3i;<init>(III)Vintermediary <init>Lnet/minecraft/class_2382;<init>(III)Vofficial <init>Lkg;<init>(III)V
 
 - 
 - 
Method Details
- 
createOffsetCodec
- Mappings:
 Namespace Name Mixin selector named createOffsetCodecLnet/minecraft/util/math/Vec3i;createOffsetCodec(I)Lcom/mojang/serialization/Codec;intermediary method_39677Lnet/minecraft/class_2382;method_39677(I)Lcom/mojang/serialization/Codec;official vLkg;v(I)Lcom/mojang/serialization/Codec;
 - 
equals
 - 
hashCode
public int hashCode() - 
compareTo
- Specified by:
 compareToin interfaceComparable<Vec3i>- Mappings:
 Namespace Name Mixin selector named compareToLnet/minecraft/util/math/Vec3i;compareTo(Lnet/minecraft/util/math/Vec3i;)Iintermediary method_10265Lnet/minecraft/class_2382;method_10265(Lnet/minecraft/class_2382;)Iofficial iLkg;i(Lkg;)I
 - 
getX
public int getX()- Mappings:
 Namespace Name Mixin selector named getXLnet/minecraft/util/math/Vec3i;getX()Iintermediary method_10263Lnet/minecraft/class_2382;method_10263()Iofficial uLkg;u()I
 - 
getY
public int getY()- Mappings:
 Namespace Name Mixin selector named getYLnet/minecraft/util/math/Vec3i;getY()Iintermediary method_10264Lnet/minecraft/class_2382;method_10264()Iofficial vLkg;v()I
 - 
getZ
public int getZ()- Mappings:
 Namespace Name Mixin selector named getZLnet/minecraft/util/math/Vec3i;getZ()Iintermediary method_10260Lnet/minecraft/class_2382;method_10260()Iofficial wLkg;w()I
 - 
setX
- Mappings:
 Namespace Name Mixin selector named setXLnet/minecraft/util/math/Vec3i;setX(I)Lnet/minecraft/util/math/Vec3i;intermediary method_20787Lnet/minecraft/class_2382;method_20787(I)Lnet/minecraft/class_2382;official uLkg;u(I)Lkg;
 - 
setY
- Mappings:
 Namespace Name Mixin selector named setYLnet/minecraft/util/math/Vec3i;setY(I)Lnet/minecraft/util/math/Vec3i;intermediary method_10099Lnet/minecraft/class_2382;method_10099(I)Lnet/minecraft/class_2382;official tLkg;t(I)Lkg;
 - 
setZ
- Mappings:
 Namespace Name Mixin selector named setZLnet/minecraft/util/math/Vec3i;setZ(I)Lnet/minecraft/util/math/Vec3i;intermediary method_20788Lnet/minecraft/class_2382;method_20788(I)Lnet/minecraft/class_2382;official sLkg;s(I)Lkg;
 - 
add
Returns another Vec3i whose coordinates have the parameter x, y, and z added to the coordinates of this vector.This method always returns an immutable object.
- Returns:
 - another Vec3i whose coordinates have the parameter x, y, and z added to the coordinates of this vector
 - Mappings:
 Namespace Name Mixin selector named addLnet/minecraft/util/math/Vec3i;add(III)Lnet/minecraft/util/math/Vec3i;intermediary method_34592Lnet/minecraft/class_2382;method_34592(III)Lnet/minecraft/class_2382;official cLkg;c(III)Lkg;
 - 
add
Returns another Vec3i whose coordinates have the coordinates ofvecadded to the coordinates of this vector.This method always returns an immutable object.
- Returns:
 - another Vec3i whose coordinates have the coordinates of 
vecadded to the coordinates of this vector - Mappings:
 Namespace Name Mixin selector named addLnet/minecraft/util/math/Vec3i;add(Lnet/minecraft/util/math/Vec3i;)Lnet/minecraft/util/math/Vec3i;intermediary method_35853Lnet/minecraft/class_2382;method_35853(Lnet/minecraft/class_2382;)Lnet/minecraft/class_2382;official fLkg;f(Lkg;)Lkg;
 - 
subtract
Returns another Vec3i whose coordinates have the coordinates ofvecsubtracted from the coordinates of this vector.This method always returns an immutable object.
- Returns:
 - another Vec3i whose coordinates have the coordinates of 
vecsubtracted from the coordinates of this vector - Mappings:
 Namespace Name Mixin selector named subtractLnet/minecraft/util/math/Vec3i;subtract(Lnet/minecraft/util/math/Vec3i;)Lnet/minecraft/util/math/Vec3i;intermediary method_35852Lnet/minecraft/class_2382;method_35852(Lnet/minecraft/class_2382;)Lnet/minecraft/class_2382;official eLkg;e(Lkg;)Lkg;
 - 
multiply
Returns a vector with all components multiplied byscale.- Returns:
 - a vector with all components multiplied by 
scale - Implementation Note:
 - This can return the same vector if 
scaleequals1. - Mappings:
 Namespace Name Mixin selector named multiplyLnet/minecraft/util/math/Vec3i;multiply(I)Lnet/minecraft/util/math/Vec3i;intermediary method_35862Lnet/minecraft/class_2382;method_35862(I)Lnet/minecraft/class_2382;official oLkg;o(I)Lkg;
 - 
up
Returns a vector which is offset by1in the upward direction.- Returns:
 - a vector which is offset by 
1in the upward direction - Mappings:
 Namespace Name Mixin selector named upLnet/minecraft/util/math/Vec3i;up()Lnet/minecraft/util/math/Vec3i;intermediary method_30931Lnet/minecraft/class_2382;method_30931()Lnet/minecraft/class_2382;official qLkg;q()Lkg;
 - 
up
Returns a vector which is offset bydistancein the upward direction.- Returns:
 - a vector which is offset by 
distancein the upward direction - Implementation Note:
 - This can return the same vector if 
distanceequals0. - Mappings:
 Namespace Name Mixin selector named upLnet/minecraft/util/math/Vec3i;up(I)Lnet/minecraft/util/math/Vec3i;intermediary method_30930Lnet/minecraft/class_2382;method_30930(I)Lnet/minecraft/class_2382;official nLkg;n(I)Lkg;
 - 
down
Returns a vector which is offset by1in the downward direction.- Returns:
 - a vector which is offset by 
1in the downward direction - Mappings:
 Namespace Name Mixin selector named downLnet/minecraft/util/math/Vec3i;down()Lnet/minecraft/util/math/Vec3i;intermediary method_23228Lnet/minecraft/class_2382;method_23228()Lnet/minecraft/class_2382;official pLkg;p()Lkg;
 - 
down
Returns a vector which is offset bydistancein the downward direction.- Returns:
 - a vector which is offset by 
distancein the downward direction - Implementation Note:
 - This can return the same vector if 
distanceequals0. - Mappings:
 Namespace Name Mixin selector named downLnet/minecraft/util/math/Vec3i;down(I)Lnet/minecraft/util/math/Vec3i;intermediary method_23227Lnet/minecraft/class_2382;method_23227(I)Lnet/minecraft/class_2382;official mLkg;m(I)Lkg;
 - 
north
Returns a vector which is offset by1in the northward direction.- Returns:
 - a vector which is offset by 
1in the northward direction - Mappings:
 Namespace Name Mixin selector named northLnet/minecraft/util/math/Vec3i;north()Lnet/minecraft/util/math/Vec3i;intermediary method_35861Lnet/minecraft/class_2382;method_35861()Lnet/minecraft/class_2382;official oLkg;o()Lkg;
 - 
north
Returns a vector which is offset bydistancein the northward direction.- Returns:
 - a vector which is offset by 
distancein the northward direction - Implementation Note:
 - This can return the same vector if 
distanceequals0. - Mappings:
 Namespace Name Mixin selector named northLnet/minecraft/util/math/Vec3i;north(I)Lnet/minecraft/util/math/Vec3i;intermediary method_35860Lnet/minecraft/class_2382;method_35860(I)Lnet/minecraft/class_2382;official lLkg;l(I)Lkg;
 - 
south
Returns a vector which is offset by1in the southward direction.- Returns:
 - a vector which is offset by 
1in the southward direction - Mappings:
 Namespace Name Mixin selector named southLnet/minecraft/util/math/Vec3i;south()Lnet/minecraft/util/math/Vec3i;intermediary method_35859Lnet/minecraft/class_2382;method_35859()Lnet/minecraft/class_2382;official nLkg;n()Lkg;
 - 
south
Returns a vector which is offset bydistancein the southward direction.- Returns:
 - a vector which is offset by 
distancein the southward direction - Implementation Note:
 - This can return the same vector if 
distanceequals0. - Mappings:
 Namespace Name Mixin selector named southLnet/minecraft/util/math/Vec3i;south(I)Lnet/minecraft/util/math/Vec3i;intermediary method_35858Lnet/minecraft/class_2382;method_35858(I)Lnet/minecraft/class_2382;official kLkg;k(I)Lkg;
 - 
west
Returns a vector which is offset by1in the westward direction.- Returns:
 - a vector which is offset by 
1in the westward direction - Mappings:
 Namespace Name Mixin selector named westLnet/minecraft/util/math/Vec3i;west()Lnet/minecraft/util/math/Vec3i;intermediary method_35857Lnet/minecraft/class_2382;method_35857()Lnet/minecraft/class_2382;official mLkg;m()Lkg;
 - 
west
Returns a vector which is offset bydistancein the westward direction.- Returns:
 - a vector which is offset by 
distancein the westward direction - Implementation Note:
 - This can return the same vector if 
distanceequals0. - Mappings:
 Namespace Name Mixin selector named westLnet/minecraft/util/math/Vec3i;west(I)Lnet/minecraft/util/math/Vec3i;intermediary method_35856Lnet/minecraft/class_2382;method_35856(I)Lnet/minecraft/class_2382;official jLkg;j(I)Lkg;
 - 
east
Returns a vector which is offset by1in the eastward direction.- Returns:
 - a vector which is offset by 
1in the eastward direction - Mappings:
 Namespace Name Mixin selector named eastLnet/minecraft/util/math/Vec3i;east()Lnet/minecraft/util/math/Vec3i;intermediary method_35855Lnet/minecraft/class_2382;method_35855()Lnet/minecraft/class_2382;official lLkg;l()Lkg;
 - 
east
Returns a vector which is offset bydistancein the eastward direction.- Returns:
 - a vector which is offset by 
distancein the eastward direction - Implementation Note:
 - This can return the same vector if 
distanceequals0. - Mappings:
 Namespace Name Mixin selector named eastLnet/minecraft/util/math/Vec3i;east(I)Lnet/minecraft/util/math/Vec3i;intermediary method_35854Lnet/minecraft/class_2382;method_35854(I)Lnet/minecraft/class_2382;official iLkg;i(I)Lkg;
 - 
offset
Returns a vector which is offset by1indirectiondirection.- Returns:
 - a vector which is offset by 
1indirectiondirection - Mappings:
 Namespace Name Mixin selector named offsetLnet/minecraft/util/math/Vec3i;offset(Lnet/minecraft/util/math/Direction;)Lnet/minecraft/util/math/Vec3i;intermediary method_35851Lnet/minecraft/class_2382;method_35851(Lnet/minecraft/class_2350;)Lnet/minecraft/class_2382;official bLkg;b(Ljh;)Lkg;
 - 
offset
Returns a vector which is offset bydistanceindirectiondirection.- Returns:
 - a vector which is offset by 
distanceindirectiondirection - Implementation Note:
 - This can return the same vector if 
distanceequals0. - Mappings:
 Namespace Name Mixin selector named offsetLnet/minecraft/util/math/Vec3i;offset(Lnet/minecraft/util/math/Direction;I)Lnet/minecraft/util/math/Vec3i;intermediary method_23226Lnet/minecraft/class_2382;method_23226(Lnet/minecraft/class_2350;I)Lnet/minecraft/class_2382;official bLkg;b(Ljh;I)Lkg;
 - 
offset
Returns a vector which is offset bydistanceonaxisaxis.- Returns:
 - a vector which is offset by 
distanceonaxisaxis - Implementation Note:
 - This can return the same vector if 
distanceequals0. - Mappings:
 Namespace Name Mixin selector named offsetLnet/minecraft/util/math/Vec3i;offset(Lnet/minecraft/util/math/Direction$Axis;I)Lnet/minecraft/util/math/Vec3i;intermediary method_35850Lnet/minecraft/class_2382;method_35850(Lnet/minecraft/class_2350$class_2351;I)Lnet/minecraft/class_2382;official bLkg;b(Ljh$a;I)Lkg;
 - 
crossProduct
- Mappings:
 Namespace Name Mixin selector named crossProductLnet/minecraft/util/math/Vec3i;crossProduct(Lnet/minecraft/util/math/Vec3i;)Lnet/minecraft/util/math/Vec3i;intermediary method_10259Lnet/minecraft/class_2382;method_10259(Lnet/minecraft/class_2382;)Lnet/minecraft/class_2382;official dLkg;d(Lkg;)Lkg;
 - 
isWithinDistance
Returns whether the distance between here andvecis less thandistance.- Returns:
 - whether the distance between here and 
vecis less thandistance - Mappings:
 Namespace Name Mixin selector named isWithinDistanceLnet/minecraft/util/math/Vec3i;isWithinDistance(Lnet/minecraft/util/math/Vec3i;D)Zintermediary method_19771Lnet/minecraft/class_2382;method_19771(Lnet/minecraft/class_2382;D)Zofficial aLkg;a(Lkg;D)Z
 - 
isWithinDistance
Returns whether the distance between here andposis less thandistance.- Returns:
 - whether the distance between here and 
posis less thandistance - Mappings:
 Namespace Name Mixin selector named isWithinDistanceLnet/minecraft/util/math/Vec3i;isWithinDistance(Lnet/minecraft/util/math/Position;D)Zintermediary method_19769Lnet/minecraft/class_2382;method_19769(Lnet/minecraft/class_2374;D)Zofficial aLkg;a(Ljv;D)Z
 - 
getSquaredDistance
Returns the squared distance between here (center) andvec.- Returns:
 - the squared distance between here (center) and 
vec - See Also:
 - Mappings:
 Namespace Name Mixin selector named getSquaredDistanceLnet/minecraft/util/math/Vec3i;getSquaredDistance(Lnet/minecraft/util/math/Vec3i;)Dintermediary method_10262Lnet/minecraft/class_2382;method_10262(Lnet/minecraft/class_2382;)Dofficial jLkg;j(Lkg;)D
 - 
getSquaredDistance
Returns the squared distance between here andpos.- Returns:
 - the squared distance between here and 
pos - Mappings:
 Namespace Name Mixin selector named getSquaredDistanceLnet/minecraft/util/math/Vec3i;getSquaredDistance(Lnet/minecraft/util/math/Position;)Dintermediary method_19770Lnet/minecraft/class_2382;method_19770(Lnet/minecraft/class_2374;)Dofficial bLkg;b(Ljv;)D
 - 
getSquaredDistanceFromCenter
public double getSquaredDistanceFromCenter(double x, double y, double z) Returns the squared distance between the center of this voxel and(x, y, z). This is equivalent toVec3d.ofCenter(this).squaredDistanceTo(x, y, z).- Returns:
 - the squared distance between the center of this voxel and 
(x, y, z) - Mappings:
 Namespace Name Mixin selector named getSquaredDistanceFromCenterLnet/minecraft/util/math/Vec3i;getSquaredDistanceFromCenter(DDD)Dintermediary method_10268Lnet/minecraft/class_2382;method_10268(DDD)Dofficial cLkg;c(DDD)D
 - 
getSquaredDistance
public double getSquaredDistance(double x, double y, double z) Returns the squared distance between here and(x, y, z). This is equivalent toVec3d.of(this).squaredDistanceTo(x, y, z).- Returns:
 - the squared distance between here and 
(x, y, z) - Mappings:
 Namespace Name Mixin selector named getSquaredDistanceLnet/minecraft/util/math/Vec3i;getSquaredDistance(DDD)Dintermediary method_40081Lnet/minecraft/class_2382;method_40081(DDD)Dofficial dLkg;d(DDD)D
 - 
getManhattanDistance
Returns the Manhattan distance between here andvec.Manhattan distance, also called taxicab distance or snake distance, is the distance measured as the sum of the absolute differences of their coordinates. For example, the Manhattan distance between
(0, 0, 0)and(1, 1, 1)is3.- Returns:
 - the Manhattan distance between here and 
vec - Mappings:
 Namespace Name Mixin selector named getManhattanDistanceLnet/minecraft/util/math/Vec3i;getManhattanDistance(Lnet/minecraft/util/math/Vec3i;)Iintermediary method_19455Lnet/minecraft/class_2382;method_19455(Lnet/minecraft/class_2382;)Iofficial kLkg;k(Lkg;)I
 - 
getChebyshevDistance
Returns the Chebyshev distance between here andvec.Chebyshev distance, also called chessboard distance, is the distance measured as the greatest of the differences of any of their coordinates. For example, the Chebyshev distance between
(0, 0, 0)and(3, 5, 1)is5.- Returns:
 - the Chebyshev distance between here and 
vec - Mappings:
 Namespace Name Mixin selector named getChebyshevDistanceLnet/minecraft/util/math/Vec3i;getChebyshevDistance(Lnet/minecraft/util/math/Vec3i;)Iintermediary method_65076Lnet/minecraft/class_2382;method_65076(Lnet/minecraft/class_2382;)Iofficial lLkg;l(Lkg;)I
 - 
getComponentAlongAxis
Returns the component on theaxisaxis.- Returns:
 - the component on the 
axisaxis - Mappings:
 Namespace Name Mixin selector named getComponentAlongAxisLnet/minecraft/util/math/Vec3i;getComponentAlongAxis(Lnet/minecraft/util/math/Direction$Axis;)Iintermediary method_30558Lnet/minecraft/class_2382;method_30558(Lnet/minecraft/class_2350$class_2351;)Iofficial aLkg;a(Ljh$a;)I
 - 
toString
 - 
toShortString
Returns the coordinates joined with a colon and a space.- Returns:
 - the coordinates joined with a colon and a space
 - Mappings:
 Namespace Name Mixin selector named toShortStringLnet/minecraft/util/math/Vec3i;toShortString()Ljava/lang/String;intermediary method_23854Lnet/minecraft/class_2382;method_23854()Ljava/lang/String;official xLkg;x()Ljava/lang/String;
 
 -