java.lang.Object
net.minecraft.world.level.levelgen.structure.BoundingBox

public class BoundingBox extends Object
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 Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • CODEC

      public static final com.mojang.serialization.Codec<BoundingBox> 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

      public BoundingBox(BlockPos pPos)
    • BoundingBox

      public BoundingBox(int pMinX, int pMinY, int pMinZ, int pMaxX, int pMaxY, int pMaxZ)
  • Method Details

    • fromCorners

      public static BoundingBox fromCorners(Vec3i pFirst, Vec3i pSecond)
    • infinite

      public static BoundingBox 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

      public Stream<ChunkPos> intersectingChunks()
    • intersects

      public boolean intersects(BoundingBox pBox)
      Returns:
      true if box 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

      public static Optional<BoundingBox> encapsulatingPositions(Iterable<BlockPos> pPositions)
    • encapsulatingBoxes

      public static Optional<BoundingBox> encapsulatingBoxes(Iterable<BoundingBox> pBoxes)
    • encapsulate

      @Deprecated public BoundingBox encapsulate(BoundingBox p_162387_)
      Deprecated.
      Expands this box to be at least large enough to contain box.
    • encapsulate

      @Deprecated public BoundingBox encapsulate(BlockPos p_162372_)
      Deprecated.
      Expands this box to be at least large enough to contain pos.
    • move

      @Deprecated public BoundingBox move(int pX, int pY, int pZ)
      Deprecated.
      Translates this box by the given coordinates, modifying the current box.
    • move

      @Deprecated public BoundingBox move(Vec3i pVector)
      Deprecated.
      Translates this box by the given vector, modifying the current box.
    • moved

      public BoundingBox moved(int pX, int pY, int pZ)
      Returns:
      A new bounding box equal to this box, translated by the given coordinates.
    • inflatedBy

      public BoundingBox inflatedBy(int pValue)
      Expands this box by a fixed value in all directions.
    • inflatedBy

      public BoundingBox inflatedBy(int pX, int pY, int pZ)
    • isInside

      public boolean isInside(Vec3i pVector)
      Returns:
      true if the bounding box contains the vector.
    • isInside

      public boolean isInside(int pX, int pY, int pZ)
    • getLength

      public Vec3i getLength()
    • getXSpan

      public int getXSpan()
    • getYSpan

      public int getYSpan()
    • getZSpan

      public int getZSpan()
    • getCenter

      public BlockPos getCenter()
    • forAllCorners

      public void forAllCorners(Consumer<BlockPos> pPos)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object pOther)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • minX

      public int minX()
    • minY

      public int minY()
    • minZ

      public int minZ()
    • maxX

      public int maxX()
    • maxY

      public int maxY()
    • maxZ

      public int maxZ()