Package net.minecraft.world.phys
Class AABB
java.lang.Object
net.minecraft.world.phys.AABB
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BlockHitResult
private static Direction
clipPoint
(double[] pMinDistance, Direction pPrevDirection, double pDistanceSide, double pDistanceOtherA, double pDistanceOtherB, double pMinSide, double pMinOtherA, double pMaxOtherA, double pMinOtherB, double pMaxOtherB, Direction pHitSide, double pStartSide, double pStartOtherA, double pStartOtherB) boolean
contains
(double pX, double pY, double pZ) boolean
Returns if the supplied Vec3D is completely inside the bounding boxcontract
(double pX, double pY, double pZ) Creates a newinvalid reference
AxisAlignedBB
deflate
(double pValue) Creates a newinvalid reference
AxisAlignedBB
deflate
(double pX, double pY, double pZ) double
distanceToSqr
(Vec3 pVec) static AABB
encapsulatingFullBlocks
(BlockPos pStartPos, BlockPos pEndPos) boolean
expandTowards
(double pX, double pY, double pZ) Creates a newinvalid reference
AxisAlignedBB
expandTowards
(Vec3 pVector) private static Direction
getDirection
(AABB pAabb, Vec3 pStart, double[] pMinDistance, Direction pFacing, double pDeltaX, double pDeltaY, double pDeltaZ) double
getSize()
double
getXsize()
double
getYsize()
double
getZsize()
int
hashCode()
boolean
hasNaN()
inflate
(double pValue) Creates a newinvalid reference
AxisAlignedBB
inflate
(double pX, double pY, double pZ) Creates a newinvalid reference
AxisAlignedBB
boolean
intersects
(double pX1, double pY1, double pZ1, double pX2, double pY2, double pZ2) boolean
intersects
(AABB pOther) Checks if the bounding box intersects with another.boolean
intersects
(Vec3 pMin, Vec3 pMax) boolean
Returns true if this AABB is infinite in all directions.double
max
(Direction.Axis pAxis) double
min
(Direction.Axis pAxis) move
(double pX, double pY, double pZ) Offsets the current bounding box by the specified amount.move
(org.joml.Vector3f p_346297_) static AABB
of
(BoundingBox pMutableBox) static AABB
setMaxX
(double pMaxX) setMaxY
(double pMaxY) setMaxZ
(double pMaxZ) setMinX
(double pMinX) setMinY
(double pMinY) setMinZ
(double pMinZ) toString()
static AABB
unitCubeFromLowerCorner
(Vec3 pVector)
-
Field Details
-
EPSILON
private static final double EPSILON- See Also:
-
INFINITE
-
minX
public final double minX -
minY
public final double minY -
minZ
public final double minZ -
maxX
public final double maxX -
maxY
public final double maxY -
maxZ
public final double maxZ
-
-
Constructor Details
-
AABB
public AABB(double pX1, double pY1, double pZ1, double pX2, double pY2, double pZ2) -
AABB
-
AABB
-
-
Method Details
-
of
-
unitCubeFromLowerCorner
-
encapsulatingFullBlocks
-
setMinX
-
setMinY
-
setMinZ
-
setMaxX
-
setMaxY
-
setMaxZ
-
min
-
max
-
equals
-
hashCode
public int hashCode() -
contract
Creates a newinvalid reference
AxisAlignedBB
If the amount to contract by is larger than the length of a side, then the side will wrap (still creating a valid AABB - see last sample).Samples:
Input Result new AxisAlignedBB(0, 0, 0, 4, 4, 4).contract(2, 2, 2)
box[0.0, 0.0, 0.0 -> 2.0, 2.0, 2.0]
new AxisAlignedBB(0, 0, 0, 4, 4, 4).contract(-2, -2, -2)
box[2.0, 2.0, 2.0 -> 4.0, 4.0, 4.0]
new AxisAlignedBB(5, 5, 5, 7, 7, 7).contract(0, 1, -1)
box[5.0, 5.0, 6.0 -> 7.0, 6.0, 7.0]
new AxisAlignedBB(-2, -2, -2, 2, 2, 2).contract(4, -4, 0)
box[-8.0, 2.0, -2.0 -> -2.0, 8.0, 2.0]
See Also:
-
invalid reference
#expand(double, double, double)
-
invalid reference
#grow(double, double, double)
invalid reference
#grow(double)
-
invalid reference
#shrink(double)
invalid reference
#grow(double)
- Returns:
- A new modified bounding box.
-
-
expandTowards
-
expandTowards
Creates a newinvalid reference
AxisAlignedBB
Samples:
Input Result new AxisAlignedBB(0, 0, 0, 1, 1, 1).expand(2, 2, 2)
box[0, 0, 0 -> 3, 3, 3]
new AxisAlignedBB(0, 0, 0, 1, 1, 1).expand(-2, -2, -2)
box[-2, -2, -2 -> 1, 1, 1]
new AxisAlignedBB(5, 5, 5, 7, 7, 7).expand(0, 1, -1)
box[5, 5, 4, 7, 8, 7]
See Also:
contract(double, double, double)
- like this, except for shrinking.-
invalid reference
#grow(double, double, double)
invalid reference
#grow(double)
-
invalid reference
#shrink(double)
invalid reference
#grow(double)
- Returns:
- A modified bounding box that will always be equal or greater in volume to this bounding box.
-
inflate
Creates a newinvalid reference
AxisAlignedBB
Side lengths will be increased by 2 times the value of the parameters, since both min and max are changed.
If contracting and the amount to contract by is larger than the length of a side, then the side will wrap (still creating a valid AABB - see last ample).Samples:
Input Result new AxisAlignedBB(0, 0, 0, 1, 1, 1).grow(2, 2, 2)
box[-2.0, -2.0, -2.0 -> 3.0, 3.0, 3.0]
new AxisAlignedBB(0, 0, 0, 6, 6, 6).grow(-2, -2, -2)
box[2.0, 2.0, 2.0 -> 4.0, 4.0, 4.0]
new AxisAlignedBB(5, 5, 5, 7, 7, 7).grow(0, 1, -1)
box[5.0, 4.0, 6.0 -> 7.0, 8.0, 6.0]
new AxisAlignedBB(1, 1, 1, 3, 3, 3).grow(-4, -2, -3)
box[-1.0, 1.0, 0.0 -> 5.0, 3.0, 4.0]
See Also:
-
invalid reference
#expand(double, double, double)
contract(double, double, double)
- contracts in only one direction.-
invalid reference
#shrink(double)
invalid reference
#grow(double)
- Returns:
- A modified bounding box.
-
-
inflate
Creates a newinvalid reference
AxisAlignedBB
invalid reference
#grow(double, double, double)
Side lengths will be increased by 2 times the value of the parameter, since both min and max are changed.
If contracting and the amount to contract by is larger than the length of a side, then the side will wrap (still creating a valid AABB - see samples oninvalid reference
#grow(double, double, double)
- Returns:
- A modified AABB.
-
intersect
-
minmax
-
move
Offsets the current bounding box by the specified amount. -
move
-
move
-
move
-
intersects
Checks if the bounding box intersects with another. -
intersects
public boolean intersects(double pX1, double pY1, double pZ1, double pX2, double pY2, double pZ2) -
intersects
-
contains
Returns if the supplied Vec3D is completely inside the bounding box -
contains
public boolean contains(double pX, double pY, double pZ) -
getSize
public double getSize() -
getXsize
public double getXsize() -
getYsize
public double getYsize() -
getZsize
public double getZsize() -
deflate
-
deflate
Creates a newinvalid reference
AxisAlignedBB
invalid reference
#grow(double)
Side lengths will be decreased by 2 times the value of the parameter, since both min and max are changed.
If contracting and the amount to contract by is larger than the length of a side, then the side will wrap (still creating a valid AABB - see samples oninvalid reference
#grow(double, double, double)
- Returns:
- A modified AABB.
-
clip
-
clip
-
getDirection
-
clipPoint
@Nullable private static Direction clipPoint(double[] pMinDistance, @Nullable Direction pPrevDirection, double pDistanceSide, double pDistanceOtherA, double pDistanceOtherB, double pMinSide, double pMinOtherA, double pMaxOtherA, double pMinOtherB, double pMaxOtherB, Direction pHitSide, double pStartSide, double pStartOtherA, double pStartOtherB) -
distanceToSqr
-
toString
-
hasNaN
public boolean hasNaN() -
getCenter
-
getBottomCenter
-
getMinPosition
-
getMaxPosition
-
ofSize
-
isInfinite
public boolean isInfinite()Returns true if this AABB is infinite in all directions.- Returns:
- true if this AABB is infinite in all directions
-