Class ParabolaExplosion
java.lang.Object
me.deecaad.weaponmechanics.weapon.explode.shapes.ParabolaExplosion
- All Implemented Interfaces:
me.deecaad.core.file.Serializer<ExplosionShape>,ExplosionShape,net.kyori.adventure.key.Keyed,org.bukkit.Keyed
Uses parabolas to calculate the area of explosions, where a parabola is defined as: y = m(x -
xOffset)^2 + yOffset xOffset is ignored here yOffset is the depth. Negative values ONLY are
allowed. m is the angle. Under 1 makes the explosion wider. Over 1 makes the explosion thinner
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for serializer.ParabolaExplosion(double depth, double angle) -
Method Summary
Modifier and TypeMethodDescriptiondoublegetAngle()doublegetArea()Returns the area, measured in meters cubed (blocks cubed), of this shape.List<org.bukkit.block.Block> getBlocks(org.bukkit.Location origin) Returns a list of all effected blocks effected by this shape if an explosion were to trigger at the givenorigin.doublegetDepth()List<org.bukkit.entity.LivingEntity> getEntities(org.bukkit.Location origin) Returns a list of all effect entities effected by this shape.org.bukkit.NamespacedKeygetKey()Return the namespaced identifier for this object.doubleReturns the maximum distance from the origin of the explosion that an entity is considered to be contained in the explosion.booleanisContained(org.bukkit.Location origin, org.bukkit.Location point) Returnstrueif the given point is contained in this shape, assuming the shape's center is located atorigin.booleanisNearEdge(double x, double y, double z, double distance) serialize(me.deecaad.core.file.SerializeData data) booleantest(double x, double y, double z) booleantest(org.bukkit.Location origin, org.bukkit.Location loc) Tests if a location is within this explosion based on the given origintoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bukkit.Keyed
keyMethods inherited from interface me.deecaad.core.file.Serializer
canUsePathTo, getKeyword, getName, getParentKeywords, getWikiLink, letPassThrough, shouldSerialize, tryPathTo, useLater
-
Constructor Details
-
ParabolaExplosion
public ParabolaExplosion()Default constructor for serializer. -
ParabolaExplosion
public ParabolaExplosion(double depth, double angle)
-
-
Method Details
-
getKey
@NotNull public org.bukkit.NamespacedKey getKey()Return the namespaced identifier for this object.- Specified by:
getKeyin interfaceorg.bukkit.Keyed- Returns:
- this object's key
-
getDepth
public double getDepth()- Returns:
- Depth of the explosion
-
getAngle
public double getAngle()- Returns:
- Angle of the parabola
-
getBlocks
Description copied from interface:ExplosionShapeReturns 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.- Specified by:
getBlocksin interfaceExplosionShape- Parameters:
origin- The non-null origin of the explosion (Usually the center).- Returns:
- The non-null list of blocks contained in the explosion.
-
getEntities
@NotNull public List<org.bukkit.entity.LivingEntity> getEntities(@NotNull org.bukkit.Location origin) Description copied from interface:ExplosionShapeReturns 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.- Specified by:
getEntitiesin interfaceExplosionShape- Parameters:
origin- The non-null origin of the explosion (Usually the center).- Returns:
- The non-null list of entities contained in the explosion.
-
getMaxDistance
public double getMaxDistance()Description copied from interface:ExplosionShapeReturns 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 (useExplosionShape.isContained(Location, Location)). This method is useful for helping to determine an entity's exposure. SeeDistanceExposure.- Specified by:
getMaxDistancein interfaceExplosionShape- Returns:
- The maximum distance away an entity takes damage.
-
test
public boolean test(org.bukkit.Location origin, org.bukkit.Location loc) Tests if a location is within this explosion based on the given origin- Parameters:
origin- Center of the explosionloc- Point to test- Returns:
- If the location is in the explosion
-
isContained
public boolean isContained(@NotNull org.bukkit.Location origin, @NotNull org.bukkit.Location point) Description copied from interface:ExplosionShapeReturnstrueif the given point is contained in this shape, assuming the shape's center is located atorigin.- Specified by:
isContainedin interfaceExplosionShape- 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
public double getArea()Description copied from interface:ExplosionShapeReturns 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.- Specified by:
getAreain interfaceExplosionShape- Returns:
- The maximum area effected by this shape.
-
test
public boolean test(double x, double y, double z) -
isNearEdge
public boolean isNearEdge(double x, double y, double z, double distance) -
serialize
@NotNull public ExplosionShape serialize(@NotNull me.deecaad.core.file.SerializeData data) throws me.deecaad.core.file.SerializerException - Specified by:
serializein interfaceme.deecaad.core.file.Serializer<ExplosionShape>- Throws:
me.deecaad.core.file.SerializerException
-
toString
-