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.

script.zs
import crafttweaker.api.world.Explosion;

Members

clearToBlow()
Clears the affected block positions of this Explosion.
script.zs
// Explosion.clearToBlow();
myExplosion.clearToBlow();
static create(world as Level, x as double, y as double, z as double, size as float, causesFire as bool, mode as BlockInteraction, exploder as Entity = null, source as DamageSource = null) as Explosion
script.zs
// Explosion.create(world as Level, x as double, y as double, z as double, size as float, causesFire as bool, mode as BlockInteraction, exploder as Entity = null, source as DamageSource = null) as Explosion;
Explosion.create(myLevel, myDouble, myDouble, myDouble, myFloat, myBool, myBlockInteraction, myEntity, myDamageSource);

Parameters:

world Type: Level
x Type: double
y Type: double
z Type: double
size Type: float
causesFire Type: bool
exploder (optional) Type: Entity

Default Value: null

source (optional) Type: DamageSource

Default Value: null

Return Type: Explosion

Getter
Gets the damage source of this Explosion.
script.zs
// Explosion.damageSource as DamageSource
myExplosion.damageSource

Return Type: DamageSource

damageSource() as DamageSource
Gets the damage source of this Explosion.

Returns: The damage source of this Explosion.

script.zs
// Explosion.damageSource() as DamageSource;
myExplosion.damageSource();

Return Type: DamageSource

explode()
Performs the first part of the explosion which is destroying the blocks.
script.zs
// Explosion.explode();
myExplosion.explode();
finalizeExplosion(spawnParticles as bool)
Performs the second part of the explosion which is the sound, drops and if enabled the particles.
script.zs
// Explosion.finalizeExplosion(spawnParticles as bool);
myExplosion.finalizeExplosion(true);

Parameters:

spawnParticles 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 null is returned.
You may need to cast the returned LivingEntity to not be nullable.
script.zs
// Explosion.indirectSourceEntity as LivingEntity
myExplosion.indirectSourceEntity

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 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.

script.zs
// Explosion.indirectSourceEntity() as LivingEntity;
myExplosion.indirectSourceEntity();

Return Type: LivingEntity

Getter
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.
script.zs
// Explosion.playerKnockbackMap as Vec3[Player]
myExplosion.playerKnockbackMap

Return Type: Vec3[Player]

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.

Returns: A Map of PlayerEntity to Vector3d depicting knockback vectors.

script.zs
// Explosion.playerKnockbackMap() as Vec3[Player];
myExplosion.playerKnockbackMap();

Return Type: Vec3[Player]

Getter
script.zs
// Explosion.toBlow as List<BlockPos>
myExplosion.toBlow

Return Type: List<BlockPos>

toBlow() as List<BlockPos>
script.zs
// Explosion.toBlow() as List<BlockPos>;
myExplosion.toBlow();

Return Type: List<BlockPos>