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.ShapeData shapeData, net.minestom.server.collision.ShapeImpl.OcclusionData occlusionData) Creates an instance of aShapeImplrecord class. -
Method Summary
Modifier and TypeMethodDescriptionGets the bounding boxes for this shape.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanintersectBox(Point position, BoundingBox boundingBox) Checks if two bounding boxes intersect.booleanintersectBoxSwept(Point rayStart, Point rayDirection, Point shapePos, BoundingBox moving, SweepResult finalResult) Checks if a moving bounding box will hit this shape.booleanisFaceFull(BlockFace face) Returns true if the given block face is completely covered by this shape, false otherwise.booleanisOccluded(Shape shape, BlockFace face) net.minestom.server.collision.ShapeImpl.OcclusionDataReturns the value of theocclusionDatarecord component.Relative EndRelative Startnet.minestom.server.collision.ShapeImpl.ShapeDataReturns the value of theshapeDatarecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from interface Shape
intersectEntity
-
Constructor Details
-
ShapeImpl
public ShapeImpl(net.minestom.server.collision.ShapeImpl.ShapeData shapeData, net.minestom.server.collision.ShapeImpl.OcclusionData occlusionData) Creates an instance of aShapeImplrecord class.- Parameters:
shapeData- the value for theshapeDatarecord componentocclusionData- the value for theocclusionDatarecord 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
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(Point rayStart, Point rayDirection, Point shapePos, BoundingBox moving, 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
-
boundingBoxes
Gets the bounding boxes for this shape. There will be more than one bounds for more complex shapes e.g. stairs.- Returns:
- the bounding boxes for this shape
-
toString
-
hashCode
-
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). -
shapeData
public net.minestom.server.collision.ShapeImpl.ShapeData shapeData()Returns the value of theshapeDatarecord component.- Returns:
- the value of the
shapeDatarecord component
-
occlusionData
public net.minestom.server.collision.ShapeImpl.OcclusionData occlusionData()Returns the value of theocclusionDatarecord component.- Returns:
- the value of the
occlusionDatarecord component
-