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
ConstructorsConstructorDescriptionShapeImpl(net.minestom.server.collision.ShapeImpl.CollisionData collisionData, net.minestom.server.collision.ShapeImpl.LightData lightData) Creates an instance of aShapeImplrecord class. -
Method Summary
Modifier and TypeMethodDescription@NotNull @Unmodifiable List<BoundingBox> Gets the collision bounding boxes for this block.net.minestom.server.collision.ShapeImpl.CollisionDataReturns the value of thecollisionDatarecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanintersectBox(@NotNull Point position, @NotNull BoundingBox boundingBox) Checks if two bounding boxes intersect.booleanintersectBoxSwept(@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.booleanisFaceFull(@NotNull BlockFace face) Returns true if the given block face is completely covered by this shape, false otherwise.booleanisOccluded(@NotNull Shape shape, @NotNull BlockFace face) net.minestom.server.collision.ShapeImpl.LightDataReturns the value of thelightDatarecord component.@NotNull @Unmodifiable List<BoundingBox> Gets the occlusion bounding boxes for this block.@NotNull PointRelative End@NotNull PointRelative Startfinal StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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 aShapeImplrecord class.- Parameters:
collisionData- the value for thecollisionDatarecord componentlightData- the value for thelightDatarecord component
-
-
Method Details
-
relativeStart
Description copied from interface:ShapeRelative Start- Specified by:
relativeStartin interfaceShape- Returns:
- Start of shape
-
relativeEnd
Description copied from interface:ShapeRelative End- Specified by:
relativeEndin interfaceShape- Returns:
- End of shape
-
isOccluded
- Specified by:
isOccludedin interfaceShape
-
isFaceFull
Description copied from interface:ShapeReturns true if the given block face is completely covered by this shape, false otherwise.- Specified by:
isFaceFullin interfaceShape- Parameters:
face- The face to test
-
intersectBox
public boolean intersectBox(@NotNull @NotNull Point position, @NotNull @NotNull BoundingBox boundingBox) Description copied from interface:ShapeChecks if two bounding boxes intersect.- Specified by:
intersectBoxin 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:ShapeChecks if a moving bounding box will hit this shape.- Specified by:
intersectBoxSweptin 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 thecollisionDatarecord component.- Returns:
- the value of the
collisionDatarecord component
-
lightData
public net.minestom.server.collision.ShapeImpl.LightData lightData()Returns the value of thelightDatarecord component.- Returns:
- the value of the
lightDatarecord component
-