Explosion

An explosion is a physical event in the Minecraft world, caused by a primed TNT, a creeper, or a fireball launched by Ghasts. An explosion can destroy nearby blocks, propel and damage nearby entities, and start fire.

Properties

 * Position . An TNT explosion happens at the center of a primed TNT, which is a 0.98*0.98*0.98 cube.
 * Power . Power of an explosion determines its blast radius . TNT explosion has 4 power, creeper explosion has 3, fireball explosion has 1.
 * Ability to generate fire . Currently only fireball explosion can start fire.



Detroying blocks
Start linearly in the direction from the explosion point to each of 1352 points that uniformly distributed on the surface of a cube centered at the explosion with an edge length of 2.

Let blast force on each line equal the explosion power multiplied by a random number in [0.7, 1.3].

Check current block every step of 0.3. A non-air block absorbs (blockResistance / 5 + 0.3) * step of the blast force ; if the blast force is not completely absorbed, the block is destroyed (air blocks can also be marked as destroyed).

The blast force is attenuated by step * 0.75 each step, if the blast force is completely absorbed or attenuated, perform the same process on the next line.

Destroyed blocks have 0.3 chance of being dropping as items.

Interaction with entities
Define attenuation as the ratio of distance from explosion to the blast radius that equals 2 * power.

For each entity where attenuation is less than 1, let impact equal (1 - attenuation) * exposure.

Try to apply (impact * impact + impact) * 4 * radius + 1 damage to the entity, and propel the entity so that its velocity increases by distance * impact in the direction from explosion to the entity.



Calculation of explosion exposure
Explosion exposure is the ratio of visible sample points to all sample points drawn uniformly from the axis-aligned bounding box (AABB) of the affected entity. Point visibility is determined with ray tracing from the explosion point to sample points. Details on the sampling method and ray tracing are beyond the scope of this article. The spacing of sample points of a primed TNT is 1/2.96.

Causing fire
If the explosion has the ability, it will randomly start fire in 1/3 of all destroyed air blocks that are above opaque blocks.

All destroyed non-air blocks will be set to air after the explosion is animated, but strangely these just generated fire blocks are also reverted to air.

Block Resistance


Typical blast radii

 * Player kill radii of 1, 2, 4 TNT explosion on the ground with 100% exposure: lowest damage isoline; 0%, 25%, 50%, 75%, 100% armor one hit kill isolines.