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.Loggerprivate static final intprivate static final longstatic final intprivate static final longprivate static final intprivate 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 distance) Offset this vector upwards by the given distance.longasLong()static longasLong(int x, int y, int z) atY(int y) below()below(int distance) 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) 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 depth, int visitLimit, BiConsumer<BlockPos, Consumer<BlockPos>> action, Predicate<BlockPos> predicate) 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 distance) 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 scalar) mutable()north()north(int distance) static BlockPosof(long packedPos) offset(int dx, int dy, int dz) 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 axis, int amount) 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 distance) 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, 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 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
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 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
-
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
-