Record Class ShapeImpl

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

public record ShapeImpl(net.minestom.server.collision.ShapeImpl.CollisionData collisionData, net.minestom.server.collision.ShapeImpl.LightData lightData) extends Record implements Shape
  • Constructor Details

    • ShapeImpl

      public ShapeImpl(net.minestom.server.collision.ShapeImpl.CollisionData collisionData, net.minestom.server.collision.ShapeImpl.LightData lightData)
      Creates an instance of a ShapeImpl record class.
      Parameters:
      collisionData - the value for the collisionData record component
      lightData - the value for the lightData record component
  • Method Details

    • relativeStart

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

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

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

      public boolean isFaceFull(BlockFace face)
      Description copied from interface: Shape
      Returns true if the given block face is completely covered by this shape, false otherwise.
      Specified by:
      isFaceFull in interface Shape
      Parameters:
      face - The face to test
    • intersectBox

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

      public boolean intersectBoxSwept(Point rayStart, Point rayDirection, Point shapePos, BoundingBox moving, 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
    • collisionBoundingBoxes

      public @Unmodifiable List<BoundingBox> collisionBoundingBoxes()
      Gets the collision bounding boxes for this block. There will be more than one bounds for more complex shapes e.g. stairs.
      Returns:
      the collision bounding boxes for this block
    • occlusionBoundingBoxes

      public @Unmodifiable List<BoundingBox> occlusionBoundingBoxes()
      Gets the occlusion bounding boxes for this block.
      Returns:
      the occlusion bounding boxes for this block
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • collisionData

      public net.minestom.server.collision.ShapeImpl.CollisionData collisionData()
      Returns the value of the collisionData record component.
      Returns:
      the value of the collisionData record component
    • lightData

      public net.minestom.server.collision.ShapeImpl.LightData lightData()
      Returns the value of the lightData record component.
      Returns:
      the value of the lightData record component