Interface ExplosionShape
- All Known Implementing Classes:
CuboidExplosion,DefaultExplosion,ParabolicExplosion,SphericalExplosion
public interface ExplosionShape
This interface outlines the shape an explosion may take. Any subclasses should
be registered using
Factory.set(String, Factory.Arguments).
Shapes usually take a few parameters to determine the approximate size of
the explosion.
Explosion shapes are registered into the ShapeFactory instance.
-
Method Summary
Modifier and TypeMethodDescriptiondoublegetArea()Returns the area, measured in meters cubed (blocks cubed), of this shape.@NotNull List<org.bukkit.block.Block>getBlocks(@NotNull org.bukkit.Location origin) Returns a list of all effected blocks effected by this shape if an explosion were to trigger at the givenorigin.List<org.bukkit.entity.LivingEntity>getEntities(@NotNull org.bukkit.Location origin) Returns a list of all effect entities effected by this shape.doubleReturns the maximum distance from the origin of the explosion that an entity is considered to be contained in the explosion.booleanisContained(@NotNull org.bukkit.Location origin, @NotNull org.bukkit.Location point) Returnstrueif the given point is contained in this shape, assuming the shape's center is located atorigin.
-
Method Details
-
getBlocks
@NotNull @NotNull List<org.bukkit.block.Block> getBlocks(@NotNull @NotNull org.bukkit.Location origin) Returns a list of all effected blocks effected by this shape if an explosion were to trigger at the givenorigin. This list will not contain any air blocks, but may still contain liquids/bedrock/ otherwise.Implementations should not filter blocks out by material (Like IRON_BLOCK, DIRT, STONE). Instead, let
BlockDamagehandle that. You may still filter out "tough" blocks, like liquids, bedrock, or obsidian.- Parameters:
origin- The non-null origin of the explosion (Usually the center).- Returns:
- The non-null list of blocks contained in the explosion.
-
getEntities
Returns a list of all effect entities effected by this shape. An entity is effected if they are contained in the area of the explosion.Data returned by this method is usually consumed by an
ExplosionExposure.- Parameters:
origin- The non-null origin of the explosion (Usually the center).- Returns:
- The non-null list of entities contained in the explosion.
-
getMaxDistance
@Nonnegative double getMaxDistance()Returns the maximum distance from the origin of the explosion that an entity is considered to be contained in the explosion. This method should NOT be used to determine whether a point is in an explosion (useisContained(Location, Location)). This method is useful for helping to determine an entity's exposure. SeeDistanceExposure.- Returns:
- The maximum distance away an entity takes damage.
-
isContained
boolean isContained(@NotNull @NotNull org.bukkit.Location origin, @NotNull @NotNull org.bukkit.Location point) Returnstrueif the given point is contained in this shape, assuming the shape's center is located atorigin.- Parameters:
origin- The non-null origin of the explosion.point- The non-null point to test.- Returns:
- True if the point is in this shape.
-
getArea
@Nonnegative double getArea()Returns the area, measured in meters cubed (blocks cubed), of this shape. Note that the returned value will be inaccurate to an unknown degree, since some shapes (likeDefaultExplosion) are based on randomness and ray-tracing.- Returns:
- The maximum area effected by this shape.
-