Class Box

java.lang.Object
com.hypixel.hytale.math.shape.Box
All Implemented Interfaces:
Shape

public class Box extends Object implements Shape
  • Field Details

    • CODEC

      public static final Codec<Box> CODEC
    • UNIT

      public static final Box UNIT
    • ZERO

      public static final Box ZERO
    • min

      @Nonnull public final org.joml.Vector3d min
    • max

      @Nonnull public final org.joml.Vector3d max
  • Constructor Details

    • Box

      public Box()
    • Box

      public Box(@Nonnull Box box)
    • Box

      public Box(@Nonnull org.joml.Vector3dc min, @Nonnull org.joml.Vector3dc max)
    • Box

      public Box(double xMin, double yMin, double zMin, double xMax, double yMax, double zMax)
  • Method Details

    • horizontallyCentered

      @Nonnull public static Box horizontallyCentered(double width, double height, double depth)
    • cube

      public static Box cube(@Nonnull org.joml.Vector3dc min, double side)
    • centeredCube

      public static Box centeredCube(@Nonnull org.joml.Vector3dc center, double inradius)
    • setMinMax

      @Nonnull public Box setMinMax(@Nonnull org.joml.Vector3dc min, @Nonnull org.joml.Vector3dc max)
    • setMinMax

      @Nonnull public Box setMinMax(@Nonnull double[] min, @Nonnull double[] max)
    • setMinMax

      @Nonnull public Box setMinMax(@Nonnull float[] min, @Nonnull float[] max)
    • setEmpty

      @Nonnull public Box setEmpty()
    • setMinMax

      @Nonnull public Box setMinMax(double min, double max)
    • union

      @Nonnull public Box union(@Nonnull Box bb)
    • assign

      @Nonnull public Box assign(@Nonnull Box other)
    • assign

      @Nonnull public Box assign(double minX, double minY, double minZ, double maxX, double maxY, double maxZ)
    • minkowskiSum

      @Nonnull public Box minkowskiSum(@Nonnull Box bb)
    • scale

      @Nonnull public Box scale(float scale)
    • normalize

      @Nonnull public Box normalize()
    • enclosingRotatedAABB

      @Nonnull public Box enclosingRotatedAABB(float pitch, float yaw, float roll)
      Computes the axis-aligned bounding box that fully encloses this box after rotating all 8 corners by the given Euler angles (pitch, yaw, roll). Uses extrinsic Z->Y->X order to match the client's intrinsic X->Y->Z quaternion composition.
    • rotateX

      @Nonnull public Box rotateX(float angleInRadians)
    • rotateY

      @Nonnull public Box rotateY(float angleInRadians)
    • rotateZ

      @Nonnull public Box rotateZ(float angleInRadians)
    • offset

      @Nonnull public Box offset(double x, double y, double z)
    • offset

      @Nonnull public Box offset(@Nonnull org.joml.Vector3dc pos)
    • sweep

      @Nonnull public Box sweep(@Nonnull org.joml.Vector3dc v)
    • extend

      @Nonnull public Box extend(double extentX, double extentY, double extentZ)
    • width

      public double width()
    • height

      public double height()
    • depth

      public double depth()
    • dimension

      public double dimension(@Nonnull Axis axis)
    • getThickness

      public double getThickness()
    • getMaximumThickness

      public double getMaximumThickness()
    • getVolume

      public double getVolume()
    • hasVolume

      public boolean hasVolume()
    • isIntersecting

      public boolean isIntersecting(@Nonnull Box other)
    • isUnitBox

      public boolean isUnitBox()
    • middleX

      public double middleX()
    • middleY

      public double middleY()
    • middleZ

      public double middleZ()
    • clone

      @Nonnull public Box clone()
    • getMin

      @Nonnull public org.joml.Vector3d getMin()
    • getMax

      @Nonnull public org.joml.Vector3d getMax()
    • getBox

      @Nonnull public Box getBox(double x, double y, double z)
      Specified by:
      getBox in interface Shape
    • containsPosition

      public boolean containsPosition(double x, double y, double z)
      Specified by:
      containsPosition in interface Shape
    • expand

      public void expand(double radius)
      Specified by:
      expand in interface Shape
    • containsBlock

      public boolean containsBlock(int x, int y, int z)
    • containsBlock

      public boolean containsBlock(@Nonnull org.joml.Vector3ic origin, int x, int y, int z)
    • forEachBlock

      public boolean forEachBlock(double x, double y, double z, double epsilon, @Nonnull TriIntPredicate consumer)
      Specified by:
      forEachBlock in interface Shape
    • forEachBlock

      public <T> boolean forEachBlock(double x, double y, double z, double epsilon, T t, @Nonnull TriIntObjPredicate<T> consumer)
      Specified by:
      forEachBlock in interface Shape
    • getMaximumExtent

      public double getMaximumExtent()
      Gets the maximum distance this hitbox extends outside of the 1x1x1 unit box.

      This is calculated by checking the minimum and maximum values for each axis. If the minimum is n where n is invalid input: '<'0 the extent for that axis in the negative direction is -n aka the number of blocks below 0. If the maximum is n where n is >1 the extent for that axis in the positive direction is n-1 aka the number of blocks above 1.

      Returns:
      the maximum distance this hitbox extends outside of the 1x1x1 unit box
    • intersectsLine

      public boolean intersectsLine(@Nonnull org.joml.Vector3dc start, @Nonnull org.joml.Vector3dc end)
      Determines whether the line from the provided start and end positions intersects with this box.
      Parameters:
      start - Starting point of the line segment.
      end - Ending point of the line segment.
      Returns:
      true if the line segment intersects the box, false otherwise.
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object