Package net.minecraft.core
Class BlockPos
java.lang.Object
net.minecraft.core.Vec3i
net.minecraft.core.BlockPos
- All Implemented Interfaces:
Comparable<Vec3i>
- Direct Known Subclasses:
BlockPos.MutableBlockPos
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec
<BlockPos> private static final org.slf4j.Logger
private static final int
private static final long
static final int
private static final long
private static final int
private static final long
static final StreamCodec
<io.netty.buffer.ByteBuf, BlockPos> private static final int
private static final int
private static final int
static final BlockPos
An immutable BlockPos with zero as all coordinates. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabove()
above
(int pDistance) Offset this vector upwards by the given distance.long
asLong()
static long
asLong
(int pX, int pY, int pZ) atY
(int pY) below()
below
(int pDistance) Offset this vector downwards by the given distance.betweenClosed
(int pX1, int pY1, int pZ1, int pX2, int pY2, int pZ2) Creates an Iterable that returns all positions in the box specified by the given corners.betweenClosed
(BlockPos pFirstPos, BlockPos pSecondPos) betweenClosedStream
(int pMinX, int pMinY, int pMinZ, int pMaxX, int pMaxY, int pMaxZ) betweenClosedStream
(BlockPos pFirstPos, BlockPos pSecondPos) betweenClosedStream
(AABB pAabb) static int
breadthFirstTraversal
(BlockPos pStartPos, int pDepth, int pVisitLimit, BiConsumer<BlockPos, Consumer<BlockPos>> pAction, Predicate<BlockPos> pPredicate) clampLocationWithin
(Vec3 pPos) static BlockPos
containing
(double pX, double pY, double pZ) static BlockPos
containing
(Position pPosition) Calculate the cross product of this and the given Vectoreast()
east
(int pDistance) findClosestMatch
(BlockPos pPos, int pWidth, int pHeight, Predicate<BlockPos> pPosFilter) static long
getFlatIndex
(long pPackedPos) static int
getX
(long pPackedPos) static int
getY
(long pPackedPos) static int
getZ
(long pPackedPos) static BlockPos
static BlockPos
multiply
(int pScalar) mutable()
north()
north
(int pDistance) static BlockPos
of
(long pPackedPos) offset
(int pDx, int pDy, int pDz) static long
offset
(long pPos, int pDx, int pDy, int pDz) static long
randomBetweenClosed
(RandomSource pRandom, int pAmount, int pMinX, int pMinY, int pMinZ, int pMaxX, int pMaxY, int pMaxZ) randomInCube
(RandomSource pRandom, int pAmount, BlockPos pCenter, int pRadius) relative
(Direction.Axis pAxis, int pAmount) Offsets this Vector by the given distance in the specified direction.south()
south
(int pDistance) static Iterable
<BlockPos.MutableBlockPos> spiralAround
(BlockPos pCenter, int pSize, Direction pRotationDirection, Direction pExpansionDirection) squareOutSouthEast
(BlockPos pPos) Deprecated.west()
west
(int pDistance) withinManhattan
(BlockPos pPos, int pXSize, int pYSize, int pZSize) withinManhattanStream
(BlockPos pPos, int pXSize, int pYSize, int pZSize) Returns a stream of positions in a box shape, ordered by closest to furthest.Methods inherited from class net.minecraft.core.Vec3i
closerThan, closerToCenterThan, compareTo, distManhattan, distSqr, distToCenterSqr, distToCenterSqr, distToLowCornerSqr, equals, get, getX, getY, getZ, hashCode, offsetCodec, setX, setY, setZ, toShortString, toString
-
Field Details
-
CODEC
-
STREAM_CODEC
-
LOGGER
private static final org.slf4j.Logger LOGGER -
ZERO
An immutable BlockPos with zero as all coordinates. -
PACKED_X_LENGTH
private static final int PACKED_X_LENGTH -
PACKED_Z_LENGTH
private static final int PACKED_Z_LENGTH -
PACKED_Y_LENGTH
public static final int PACKED_Y_LENGTH -
PACKED_X_MASK
private static final long PACKED_X_MASK -
PACKED_Y_MASK
private static final long PACKED_Y_MASK -
PACKED_Z_MASK
private static final long PACKED_Z_MASK -
Y_OFFSET
private static final int Y_OFFSET- See Also:
-
Z_OFFSET
private static final int Z_OFFSET -
X_OFFSET
private static final int X_OFFSET
-
-
Constructor Details
-
BlockPos
public BlockPos(int pX, int pY, int pZ) -
BlockPos
-
-
Method Details
-
offset
-
offset
public static long offset(long pPos, int pDx, int pDy, int pDz) -
getX
public static int getX(long pPackedPos) -
getY
public static int getY(long pPackedPos) -
getZ
public static int getZ(long pPackedPos) -
of
-
containing
-
containing
-
min
-
max
-
asLong
public long asLong() -
asLong
public static long asLong(int pX, int pY, int pZ) -
getFlatIndex
public static long getFlatIndex(long pPackedPos) -
offset
-
getCenter
-
getBottomCenter
-
offset
-
subtract
-
multiply
-
above
-
above
Offset this vector upwards by the given distance. -
below
-
below
Offset this vector downwards by the given distance. -
north
-
north
-
south
-
south
-
west
-
west
-
east
-
east
-
relative
-
relative
Offsets this Vector by the given distance in the specified direction. -
relative
-
rotate
-
cross
Calculate the cross product of this and the given Vector -
atY
-
immutable
-
mutable
-
clampLocationWithin
-
randomInCube
public static Iterable<BlockPos> randomInCube(RandomSource pRandom, int pAmount, BlockPos pCenter, int pRadius) -
squareOutSouthEast
Deprecated. -
randomBetweenClosed
public static Iterable<BlockPos> randomBetweenClosed(RandomSource pRandom, int pAmount, int pMinX, int pMinY, int pMinZ, int pMaxX, int pMaxY, int pMaxZ) -
withinManhattan
-
findClosestMatch
-
withinManhattanStream
public static Stream<BlockPos> withinManhattanStream(BlockPos pPos, int pXSize, int pYSize, int pZSize) Returns a stream of positions in a box shape, ordered by closest to furthest. Returns by definition the given position as first element in the stream. -
betweenClosed
-
betweenClosedStream
-
betweenClosedStream
-
betweenClosedStream
-
betweenClosedStream
-
betweenClosed
public static Iterable<BlockPos> betweenClosed(int pX1, int pY1, int pZ1, int pX2, int pY2, int pZ2) Creates an Iterable that returns all positions in the box specified by the given corners. Coordinates must be in order. e.g. x1 invalid input: '<'= x2. This method usesMutableBlockPos
instead of regular BlockPos, which grants better performance. However, the resulting BlockPos instances can only be used inside the iteration loop (as otherwise the value will change), unlessinvalid reference
#toImmutable()
- See Also:
-
spiralAround
public static Iterable<BlockPos.MutableBlockPos> spiralAround(BlockPos pCenter, int pSize, Direction pRotationDirection, Direction pExpansionDirection) -
breadthFirstTraversal
-