Class BoundingBox
java.lang.Object
net.minecraft.world.level.levelgen.structure.BoundingBox
A simple three-dimensional mutable integer bounding box.
Note that this box is both mutable, and has an implementation of
hashCode() and equals().
This can be used as HashMap keys for example, if the user can ensure the instances themselves are not modified.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<BoundingBox> private static final org.slf4j.Loggerprivate intprivate intprivate intprivate intprivate intprivate intstatic final StreamCodec<io.netty.buffer.ByteBuf, BoundingBox> -
Constructor Summary
ConstructorsConstructorDescriptionBoundingBox(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) BoundingBox(BlockPos content) -
Method Summary
Modifier and TypeMethodDescriptionencapsulate(BlockPos pos) Deprecated.encapsulate(BoundingBox other) Deprecated.static BoundingBoxstatic Optional<BoundingBox> encapsulatingBoxes(Iterable<BoundingBox> iterable) static Optional<BoundingBox> encapsulatingPositions(Iterable<BlockPos> iterable) booleanvoidforAllCorners(Consumer<BlockPos> consumer) static BoundingBoxfromCorners(Vec3i pos0, Vec3i pos1) intgetXSpan()intgetYSpan()intgetZSpan()inthashCode()static BoundingBoxinfinite()inflatedBy(int amountToAddAllDirections) Expands this box by a fixedvaluein all directions.inflatedBy(int inflateX, int inflateY, int inflateZ) booleanintersects(int minX, int minZ, int maxX, int maxZ) booleanintersects(BoundingBox other) booleanisInside(int x, int y, int z) booleanintmaxX()intmaxY()intmaxZ()intminX()intminY()intminZ()move(int dx, int dy, int dz) Deprecated.Deprecated.moved(int dx, int dy, int dz) static BoundingBoxorientBox(int footX, int footY, int footZ, int offX, int offY, int offZ, int width, int height, int depth, Direction direction) Create a bounding box with the specified dimensions and rotate it.toString()
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
CODEC
-
STREAM_CODEC
-
minX
private int minX -
minY
private int minY -
minZ
private int minZ -
maxX
private int maxX -
maxY
private int maxY -
maxZ
private int maxZ
-
-
Constructor Details
-
BoundingBox
-
BoundingBox
public BoundingBox(int minX, int minY, int minZ, int maxX, int maxY, int maxZ)
-
-
Method Details
-
fromCorners
-
infinite
-
orientBox
public static BoundingBox orientBox(int footX, int footY, int footZ, int offX, int offY, int offZ, int width, int height, int depth, Direction direction) Create a bounding box with the specified dimensions and rotate it. Used to project a possible new component Bounding Box - to check if it would cut anything already spawned. -
intersectingChunks
-
intersects
- Returns:
trueifboxintersects this box.
-
intersects
public boolean intersects(int minX, int minZ, int maxX, int maxZ) - Returns:
trueif this bounding box intersects the horizontal x/z region described by the min and max parameters.
-
encapsulatingPositions
-
encapsulatingBoxes
-
encapsulate
Deprecated.Expands this box to be at least large enough to containbox. -
encapsulating
-
encapsulate
Deprecated.Expands this box to be at least large enough to containpos. -
move
Deprecated.Translates this box by the given coordinates, modifying the current box. -
move
Deprecated.Translates this box by the given vector, modifying the current box. -
moved
- Returns:
- A new bounding box equal to this box, translated by the given coordinates.
-
inflatedBy
Expands this box by a fixedvaluein all directions. -
inflatedBy
-
isInside
- Returns:
trueif the bounding box contains thevector.
-
isInside
public boolean isInside(int x, int y, int z) -
getLength
-
getXSpan
public int getXSpan() -
getYSpan
public int getYSpan() -
getZSpan
public int getZSpan() -
getCenter
-
forAllCorners
-
toString
-
equals
-
hashCode
-
minX
public int minX() -
minY
public int minY() -
minZ
public int minZ() -
maxX
public int maxX() -
maxY
public int maxY() -
maxZ
public int maxZ()
-