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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBoundingBox(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) BoundingBox(BlockPos pos) -
Method Summary
Modifier and TypeMethodDescriptionencapsulate(BlockPos pos) Deprecated.encapsulate(BoundingBox box) Deprecated.static Optional<BoundingBox> encapsulatingBoxes(Iterable<BoundingBox> boxes) static Optional<BoundingBox> encapsulatingPositions(Iterable<BlockPos> positions) booleanvoidforAllCorners(Consumer<BlockPos> pos) static BoundingBoxfromCorners(Vec3i first, Vec3i second) intgetXSpan()intgetYSpan()intgetZSpan()inthashCode()static BoundingBoxinfinite()inflatedBy(int value) Expands this box by a fixedvaluein all directions.inflatedBy(int x, int y, int z) booleanintersects(int minX, int minZ, int maxX, int maxZ) booleanintersects(BoundingBox box) booleanisInside(int x, int y, int z) booleanintmaxX()intmaxY()intmaxZ()intminX()intminY()intminZ()move(int x, int y, int z) Deprecated.Deprecated.moved(int x, int y, int z) static BoundingBoxorientBox(int structureMinX, int structureMinY, int structureMinZ, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, Direction facing) Create a bounding box with the specified dimensions and rotate it.toString()
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
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 structureMinX, int structureMinY, int structureMinZ, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, Direction facing) 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. -
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
public int 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()
-