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 ClassesModifier and TypeClassDescriptionstatic classstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<BlockPos> private static final org.slf4j.Loggerstatic final intstatic final intprivate static final longstatic final intprivate static final longprivate static final longstatic final StreamCodec<io.netty.buffer.ByteBuf, BlockPos> private static final intprivate static final intprivate static final intstatic final BlockPosAn immutable BlockPos with zero as all coordinates. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabove()above(int p_121972_) Offset this vector upwards by the given distance.longasLong()static longasLong(int x, int y, int z) atY(int y) below()below(int p_122000_) Offset this vector downwards by the given distance.betweenClosed(int x1, int y1, int z1, int x2, int y2, int z2) Creates an Iterable that returns all positions in the box specified by the given corners.betweenClosed(BlockPos firstPos, BlockPos secondPos) betweenClosed(AABB box) betweenClosedStream(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) betweenClosedStream(BlockPos firstPos, BlockPos secondPos) betweenClosedStream(AABB aabb) static intbreadthFirstTraversal(BlockPos startPos, int radius, int maxBlocks, BiConsumer<BlockPos, Consumer<BlockPos>> childrenGetter, Function<BlockPos, BlockPos.TraversalNodeStatus> action) clampLocationWithin(Vec3 pos) static BlockPoscontaining(double x, double y, double z) static BlockPoscontaining(Position position) Calculate the cross product of this and the given Vectoreast()east(int p_122031_) findClosestMatch(BlockPos pos, int width, int height, Predicate<BlockPos> posFilter) static longgetFlatIndex(long packedPos) static intgetX(long packedPos) static intgetY(long packedPos) static intgetZ(long packedPos) static BlockPosstatic BlockPosmultiply(int p_175263_) mutable()north()north(int p_122014_) static BlockPosof(long packedPos) offset(int p_121973_, int p_121974_, int p_121975_) static longoffset(long pos, int dx, int dy, int dz) static longrandomBetweenClosed(RandomSource random, int amount, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) randomInCube(RandomSource random, int amount, BlockPos center, int radius) relative(Direction.Axis p_121943_, int p_121944_) Offsets this Vector by the given distance in the specified direction.south()south(int distance) static Iterable<BlockPos.MutableBlockPos> spiralAround(BlockPos center, int size, Direction rotationDirection, Direction expansionDirection) Deprecated.west()west(int p_122026_) withinManhattan(BlockPos pos, int xSize, int ySize, int zSize) withinManhattanStream(BlockPos pos, int xSize, int ySize, int zSize) 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, distChessboard, 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_HORIZONTAL_LENGTH
public static final int PACKED_HORIZONTAL_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 -
MAX_HORIZONTAL_COORDINATE
public static final int MAX_HORIZONTAL_COORDINATE
-
-
Constructor Details
-
BlockPos
public BlockPos(int x, int y, int z) -
BlockPos
-
-
Method Details
-
offset
-
offset
public static long offset(long pos, int dx, int dy, int dz) -
getX
public static int getX(long packedPos) -
getY
public static int getY(long packedPos) -
getZ
public static int getZ(long packedPos) -
of
-
containing
-
containing
-
min
-
max
-
asLong
public long asLong() -
asLong
public static long asLong(int x, int y, int z) -
getFlatIndex
public static long getFlatIndex(long packedPos) -
offset
-
getCenter
-
getBottomCenter
-
offset
-
subtract
-
multiply
-
above
-
above
Description copied from class:Vec3iOffset this vector upwards by the given distance. -
below
-
below
Description copied from class:Vec3iOffset this vector downwards by the given distance. -
north
-
north
-
south
-
south
-
west
-
west
-
east
-
east
-
relative
-
relative
Description copied from class:Vec3iOffsets this Vector by the given distance in the specified direction. -
relative
-
rotate
-
cross
Description copied from class:Vec3iCalculate the cross product of this and the given Vector -
atY
-
immutable
-
mutable
-
clampLocationWithin
-
randomInCube
public static Iterable<BlockPos> randomInCube(RandomSource random, int amount, BlockPos center, int radius) -
squareOutSouthEast
Deprecated. -
randomBetweenClosed
public static Iterable<BlockPos> randomBetweenClosed(RandomSource random, int amount, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) -
withinManhattan
-
findClosestMatch
-
withinManhattanStream
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
-
betweenClosed
-
betweenClosedStream
-
betweenClosedStream
-
betweenClosedStream
-
betweenClosedStream
-
betweenClosed
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 usesMutableBlockPosinstead 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), unlessis called. This method is ideal for searching large areas and only storing a few locations.invalid reference
#toImmutable()- See Also:
-
spiralAround
public static Iterable<BlockPos.MutableBlockPos> spiralAround(BlockPos center, int size, Direction rotationDirection, Direction expansionDirection) -
breadthFirstTraversal
public static int breadthFirstTraversal(BlockPos startPos, int radius, int maxBlocks, BiConsumer<BlockPos, Consumer<BlockPos>> childrenGetter, Function<BlockPos, BlockPos.TraversalNodeStatus> action)
-