Class BoundingBox

java.lang.Object
net.minestom.server.collision.BoundingBox
All Implemented Interfaces:
Shape

public final class BoundingBox extends Object implements Shape
See https://wiki.vg/Entity_metadata#Mobs_2
  • Constructor Details

    • BoundingBox

      public BoundingBox(double width, double height, double depth, Point offset)
    • BoundingBox

      public BoundingBox(double width, double height, double depth)
  • Method Details

    • isOccluded

      public boolean isOccluded(@NotNull @NotNull Shape shape, @NotNull @NotNull BlockFace face)
      Specified by:
      isOccluded in interface Shape
    • intersectBox

      @Experimental public boolean intersectBox(@NotNull @NotNull Point positionRelative, @NotNull @NotNull BoundingBox boundingBox)
      Description copied from interface: Shape
      Checks if two bounding boxes intersect.
      Specified by:
      intersectBox in interface Shape
      Parameters:
      positionRelative - Relative position of bounding box to check with
      boundingBox - Bounding box to check for intersections with
      Returns:
      is an intersection found
    • intersectBoxSwept

      @Experimental public boolean intersectBoxSwept(@NotNull @NotNull Point rayStart, @NotNull @NotNull Point rayDirection, @NotNull @NotNull Point shapePos, @NotNull @NotNull BoundingBox moving, @NotNull @NotNull SweepResult finalResult)
      Description copied from interface: Shape
      Checks if a moving bounding box will hit this shape.
      Specified by:
      intersectBoxSwept in interface Shape
      Parameters:
      rayStart - Position of the moving shape
      rayDirection - Movement vector
      shapePos - Position of this shape
      moving - Bounding Box of moving shape
      finalResult - Stores final SweepResult
      Returns:
      is an intersection found
    • boundingBoxRayIntersectionCheck

      @Experimental public boolean boundingBoxRayIntersectionCheck(Vec start, Vec direction, Pos position)
    • relativeStart

      @NotNull public @NotNull Point relativeStart()
      Description copied from interface: Shape
      Relative Start
      Specified by:
      relativeStart in interface Shape
      Returns:
      Start of shape
    • relativeEnd

      @NotNull public @NotNull Point relativeEnd()
      Description copied from interface: Shape
      Relative End
      Specified by:
      relativeEnd in interface Shape
      Returns:
      End of shape
    • toString

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

      @NotNull public @NotNull BoundingBox expand(double x, double y, double z)
      Creates a new BoundingBox with an expanded size.
      Parameters:
      x - the X offset
      y - the Y offset
      z - the Z offset
      Returns:
      a new BoundingBox expanded
    • contract

      @NotNull public @NotNull BoundingBox contract(double x, double y, double z)
      Creates a new BoundingBox with a contracted size.
      Parameters:
      x - the X offset
      y - the Y offset
      z - the Z offset
      Returns:
      a new bounding box contracted
    • withOffset

      @NotNull public @NotNull BoundingBox withOffset(Point offset)
      Creates a new BoundingBox with an offset.
      Parameters:
      offset - the offset
      Returns:
      a new bounding box with an offset.
    • width

      public double width()
    • height

      public double height()
    • depth

      public double depth()
    • minX

      public double minX()
    • maxX

      public double maxX()
    • minY

      public double minY()
    • maxY

      public double maxY()
    • minZ

      public double minZ()
    • maxZ

      public double maxZ()
    • getBlocks

      public Iterator<Point> getBlocks(Point point)
    • getBlocks

      public Iterator<Point> getBlocks(Point point, BoundingBox.AxisMask axisMask, double axis)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • fromPose

      @Nullable public static @Nullable BoundingBox fromPose(@NotNull Entity.Pose pose)