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 pMinX, int pMinY, int pMinZ, int pMaxX, int pMaxY, int pMaxZ) BoundingBox
(BlockPos pPos) -
Method Summary
Modifier and TypeMethodDescriptionencapsulate
(BlockPos p_162372_) Deprecated.encapsulate
(BoundingBox p_162387_) Deprecated.static Optional
<BoundingBox> encapsulatingBoxes
(Iterable<BoundingBox> pBoxes) static Optional
<BoundingBox> encapsulatingPositions
(Iterable<BlockPos> pPositions) boolean
void
forAllCorners
(Consumer<BlockPos> pPos) static BoundingBox
fromCorners
(Vec3i pFirst, Vec3i pSecond) int
getXSpan()
int
getYSpan()
int
getZSpan()
int
hashCode()
static BoundingBox
infinite()
inflatedBy
(int pValue) Expands this box by a fixedvalue
in all directions.inflatedBy
(int pX, int pY, int pZ) boolean
intersects
(int pMinX, int pMinZ, int pMaxX, int pMaxZ) boolean
intersects
(BoundingBox pBox) boolean
isInside
(int pX, int pY, int pZ) boolean
int
maxX()
int
maxY()
int
maxZ()
int
minX()
int
minY()
int
minZ()
move
(int pX, int pY, int pZ) Deprecated.Deprecated.moved
(int pX, int pY, int pZ) static BoundingBox
orientBox
(int pStructureMinX, int pStructureMinY, int pStructureMinZ, int pXMin, int pYMin, int pZMin, int pXMax, int pYMax, int pZMax, Direction pFacing) 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 pMinX, int pMinY, int pMinZ, int pMaxX, int pMaxY, int pMaxZ)
-
-
Method Details
-
fromCorners
-
infinite
-
orientBox
public static BoundingBox orientBox(int pStructureMinX, int pStructureMinY, int pStructureMinZ, int pXMin, int pYMin, int pZMin, int pXMax, int pYMax, int pZMax, Direction pFacing) 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:
true
ifbox
intersects this box.
-
intersects
public boolean intersects(int pMinX, int pMinZ, int pMaxX, int pMaxZ) - Returns:
true
if 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 fixedvalue
in all directions. -
inflatedBy
-
isInside
- Returns:
true
if the bounding box contains thevector
.
-
isInside
public boolean isInside(int pX, int pY, int pZ) -
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()
-