Package net.minestom.server.collision
Record Class ShapeImpl
java.lang.Object
java.lang.Record
net.minestom.server.collision.ShapeImpl
- All Implemented Interfaces:
Shape
-
Constructor Summary
ConstructorDescriptionShapeImpl
(net.minestom.server.collision.ShapeImpl.CollisionData collisionData, net.minestom.server.collision.ShapeImpl.LightData lightData) Creates an instance of aShapeImpl
record class. -
Method Summary
Modifier and TypeMethodDescription@NotNull @Unmodifiable List
<BoundingBox> Gets the collision bounding boxes for this block.net.minestom.server.collision.ShapeImpl.CollisionData
Returns the value of thecollisionData
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
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 thelightData
record component.@NotNull @Unmodifiable List
<BoundingBox> Gets the occlusion bounding boxes for this block.@NotNull Point
Relative End@NotNull Point
Relative Startfinal String
toString()
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 aShapeImpl
record class.- Parameters:
collisionData
- the value for thecollisionData
record componentlightData
- the value for thelightData
record component
-
-
Method Details
-
relativeStart
Description copied from interface:Shape
Relative Start- Specified by:
relativeStart
in interfaceShape
- Returns:
- Start of shape
-
relativeEnd
Description copied from interface:Shape
Relative End- Specified by:
relativeEnd
in interfaceShape
- Returns:
- End of shape
-
isOccluded
- Specified by:
isOccluded
in interfaceShape
-
isFaceFull
Description copied from interface:Shape
Returns true if the given block face is completely covered by this shape, false otherwise.- Specified by:
isFaceFull
in interfaceShape
- 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 interfaceShape
- Parameters:
position
- Relative position of bounding box to check withboundingBox
- 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 interfaceShape
- Parameters:
rayStart
- Position of the moving shaperayDirection
- Movement vectorshapePos
- Position of this shapemoving
- Bounding Box of moving shapefinalResult
- Stores final SweepResult- Returns:
- is an intersection found
-
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
Gets the occlusion bounding boxes for this block.- Returns:
- the occlusion bounding boxes for this block
-
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. -
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. -
equals
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 withObjects::equals(Object,Object)
. -
collisionData
public net.minestom.server.collision.ShapeImpl.CollisionData collisionData()Returns the value of thecollisionData
record component.- Returns:
- the value of the
collisionData
record component
-
lightData
public net.minestom.server.collision.ShapeImpl.LightData lightData()Returns the value of thelightData
record component.- Returns:
- the value of the
lightData
record component
-