Explosion
Importing the class
If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.
Constructors
new(level as Level, entity as Entity, x as double, y as double, z as double, size as float, causesFire as bool, mode as BlockInteraction)
Parameters:
x: double
Type: double
- The x position. y: double
Type: double
- The y position. z: double
Type: double
- The z position. size: float
Type: float
- How big is the explosion causesFire: bool
Type: bool
- Does the explosion cause fire mode: ExplosionBlockInteraction
Type: ExplosionBlockInteraction
- How should the explosion interact with blocks Members
clearToBlow()
Clears the affected block positions of this Explosion.
Getter
Gets the damage source of this Explosion.
Return Type:
DamageSource
damageSource() as DamageSource
Gets the damage source of this Explosion.
Returns: The damage source of this Explosion.
Return Type:
DamageSource
explode()
Performs the first part of the explosion which is destroying the blocks.
finalizeExplosion(spawnParticles as bool)
Performs the second part of the explosion which is the sound, drops and if enabled the particles.
Parameters:
spawnParticles: bool
Type: bool
- Should particles be spawned. Getter
Gets the LivingEntity that caused this Explosion.
For example: If the Explosion was caused by TNT, it will return the PlayerEntity that placed it. If the Explosion was caused by a Creeper or another Entity directly, it will return that Entity. If the Explosion was caused by a Ghast fireball, it will return the Ghast.
If no Entity caused this Explosion (for example, if the Explosion was caused by TNT in a Desert Temple that generated in the world), then
You may need to cast the returned LivingEntity to not be nullable.
For example: If the Explosion was caused by TNT, it will return the PlayerEntity that placed it. If the Explosion was caused by a Creeper or another Entity directly, it will return that Entity. If the Explosion was caused by a Ghast fireball, it will return the Ghast.
If no Entity caused this Explosion (for example, if the Explosion was caused by TNT in a Desert Temple that generated in the world), then
null
is returned.You may need to cast the returned LivingEntity to not be nullable.
Return Type:
LivingEntity
indirectSourceEntity() as LivingEntity
Gets the LivingEntity that caused this Explosion.
For example: If the Explosion was caused by TNT, it will return the PlayerEntity that placed it. If the Explosion was caused by a Creeper or another Entity directly, it will return that Entity. If the Explosion was caused by a Ghast fireball, it will return the Ghast.
If no Entity caused this Explosion (for example, if the Explosion was caused by TNT in a Desert Temple that generated in the world), then
You may need to cast the returned LivingEntity to not be nullable.
For example: If the Explosion was caused by TNT, it will return the PlayerEntity that placed it. If the Explosion was caused by a Creeper or another Entity directly, it will return that Entity. If the Explosion was caused by a Ghast fireball, it will return the Ghast.
If no Entity caused this Explosion (for example, if the Explosion was caused by TNT in a Desert Temple that generated in the world), then
null
is returned.You may need to cast the returned LivingEntity to not be nullable.
Returns: The LivingEntity that caused this Explosion. null
if no LivingEntity caused it.
Return Type:
LivingEntity
Getter
playerKnockbackMap() as Vec3[Player]
Gets the player knockback map for this Explosion.
This map is only populated in Explosion#explode() so calling it before will return nothing.
This map is used to calculate the vectors that players around the explosion will be pushed back by.
This map is only populated in Explosion#explode() so calling it before will return nothing.
This map is used to calculate the vectors that players around the explosion will be pushed back by.
Returns: A Map of PlayerEntity to Vector3d depicting knockback vectors.