Package net.minestom.server.collision
Interface Shape
- All Known Implementing Classes:
BoundingBox,Entity,EntityCreature,EntityProjectile,ExperienceOrb,ItemEntity,LivingEntity,Player,PlayerProjectile,ShapeImpl
@Experimental
public interface Shape
-
Method Summary
Modifier and TypeMethodDescriptionbooleanintersectBox(@NotNull Point positionRelative, @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.default booleanintersectEntity(@NotNull Point src, @NotNull Entity entity) Used to know if thisBoundingBoxintersects with the bounding box of an entity.default 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) @NotNull PointRelative End@NotNull PointRelative Start
-
Method Details
-
isOccluded
-
isFaceFull
Returns true if the given block face is completely covered by this shape, false otherwise.- Parameters:
face- The face to test
-
intersectBox
boolean intersectBox(@NotNull @NotNull Point positionRelative, @NotNull @NotNull BoundingBox boundingBox) Checks if two bounding boxes intersect.- Parameters:
positionRelative- Relative position of bounding box to check withboundingBox- Bounding box to check for intersections with- Returns:
- is an intersection found
-
intersectBoxSwept
boolean intersectBoxSwept(@NotNull @NotNull Point rayStart, @NotNull @NotNull Point rayDirection, @NotNull @NotNull Point shapePos, @NotNull @NotNull BoundingBox moving, @NotNull @NotNull SweepResult finalResult) Checks if a moving bounding box will hit this shape.- 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
-
intersectEntity
@Experimental default boolean intersectEntity(@NotNull @NotNull Point src, @NotNull @NotNull Entity entity) Used to know if thisBoundingBoxintersects with the bounding box of an entity.- Parameters:
entity- the entity to check the bounding box- Returns:
- true if this bounding box intersects with the entity, false otherwise
-
relativeStart
Relative Start- Returns:
- Start of shape
-
relativeEnd
Relative End- Returns:
- End of shape
-