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



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

The maximum travel distance in the air of a TNT explosion is 6.9, 5.1 for a creeper explosion, and 1.5 for a fireball explosion. For example, a TNT explosion can destroy a torch 7 blocks away. The minimum block resistance required to absorb maximum blast force of TNT explosion (with at least attenuation of 2 steps) is 77.67, 63.5 of creeper explosion, 20.17 of fireball explosion. So water, stationary lava, obsidian, and bedrock are always indestructible, and furnaces and less resistant blocks can be destroyed by fireballs.

Destroyed blocks have 0.3 chance of being dropped 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 (impact2 + impact) * 4 * radius + 1 damage to the entity, and propel the entity so that its velocity increases by impact in the direction from explosion to the entity.

As a result, entities will always get at least 1 damage if they are within blast radius, regardless of explosion exposure.



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.

AABB sampling error results in directional asymmetry of propulsion. For example, a typical TNT cannon has maximum range in the west direction partly because the sampled AABB of a primed TNT has largest exposure in that direction.

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. This bug makes fireballs actually unable to start fire.

Block Resistance
The data below is pulled from a running instance of Minecraft (beta 1.1_02).



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.