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 Summary

    Constructors
    Constructor
    Description
    ShapeImpl(net.minestom.server.collision.ShapeImpl.CollisionData collisionData, net.minestom.server.collision.ShapeImpl.LightData lightData)
    Creates an instance of a ShapeImpl record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull @Unmodifiable List<BoundingBox>
    Gets the collision bounding boxes for this block.
    net.minestom.server.collision.ShapeImpl.CollisionData
    Returns the value of the collisionData record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    intersectBox(@NotNull Point position, @NotNull BoundingBox boundingBox)
    Checks if two bounding boxes intersect.
    boolean
    intersectBoxSwept(@NotNull Point rayStart, @NotNull Point rayDirection, @NotNull Point shapePos, @NotNull BoundingBox moving, @NotNull SweepResult finalResult)
    Checks if a moving bounding box will hit this shape.
    boolean
    isFaceFull(@NotNull BlockFace face)
    Returns true if the given block face is completely covered by this shape, false otherwise.
    boolean
    isOccluded(@NotNull Shape shape, @NotNull BlockFace face)
     
    net.minestom.server.collision.ShapeImpl.LightData
    Returns the value of the lightData record component.
    @NotNull @Unmodifiable List<BoundingBox>
    Gets the occlusion bounding boxes for this block.
    @NotNull Point
    Relative End
    @NotNull Point
    Relative Start
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.minestom.server.collision.Shape

    intersectEntity
  • 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

      @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
    • isOccluded

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

      public boolean isFaceFull(@NotNull @NotNull 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(@NotNull @NotNull Point position, @NotNull @NotNull 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(@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
    • collisionBoundingBoxes

      @NotNull public @NotNull @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

      @NotNull public @NotNull @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