Minecraft:Explosion
More actions
Template:Redirect Template:Redirect
An explosion is a physical event, generally destructive, that occurs in several different circumstances. It can destroy nearby Minecraft:blocks, propel and damage nearby Minecraft:entities, and cause Minecraft:fires in some cases. Explosions produce a "shockwave" Minecraft:particle effect. Explosives include Minecraft:ghast fireballs, Minecraft:TNT, Minecraft:End crystals, Minecraft:beds when used outside of the Overworld, and Minecraft:respawn anchors when used outside of the Nether.
The propulsion effect of explosions is often used for TNT cannons.
Interaction with entities
Velocity
Each affected entity is accelerated by between 0 and 1 blocks per game Minecraft:tick (0 to 20 blocks per second), added to its current velocity. This effect can accumulate over multiple explosions, even within a single tick.
The magnitude of the velocity given to each entity in the range of an explosion is calculated with the following code: <syntaxhighlight lang="java"> magnitude = (1 - distance/(2*power)) * exposure * knockbackMultiplier * (1 - EXPLOSION_KNOCKBACK_RESISTANCE) </syntaxhighlight> Or in formula form, <math>\left(1-\frac{\text{distance}}{2\cdot\text{power}}\right)\cdot\text{exposure}\cdot\text{knockback multiplier}\cdot\left(1-\text{explosion knockback resistance}\right)</math>.
Distance is measured from the explosion center to the entity's feet position. A list of explosion powers can be found in the Causes section. Exposure is discussed in the Exposure section. Explosion knockback resistance refers to the Minecraft:attribute explosion_knockback_resistance. The knockback multiplier depends on the cause:
| Cause | Knockback multiplier |
|---|---|
| Default | 1.0 |
| Wind charge | 1.22 (Template:Wikipedia) |
To calculate the final velocity, the game takes the vector pointing from the explosion center to the entity's eye position and sets its length to the previously calculated magnitude. Minecraft:TNT entities are the only exception, where the direction goes to the tnt's feet instead of its eyes.
Damage
The following code is used to calculate the damage inflicted on an entity:
<syntaxhighlight lang="java"> impact = (1 - distance/(2*power)) * exposure; damage = (float)((impact*impact + impact)/2 * 7*(2*power) + 1) </syntaxhighlight> In formula form, this is:
<math>\text{impact} = \left( 1- \frac{\text{distance}}{2 \cdot \text{power}} \right) \cdot \text{exposure}</math>
<math>\text{damage} = 7 \cdot \text{power} \cdot \left (\text {impact}^2 + \text{impact} \right) + 1</math>.
Players are damaged differently depending on Minecraft:difficulty. The main damage value is used to calculate the final damage in other difficulties:
| Difficulty | Damage calculation |
|---|---|
| Minecraft:Peaceful | No damage |
| Minecraft:Easy | min(damage/2 + 1, damage)
|
| Minecraft:Normal | damage
|
| Minecraft:Hard | damage * 3/2
|
At the end of each game Minecraft:tick only the highest single explosion damage is chosen. Note that the main damage value has a +1 at the end, so all entities in range (within <math>2\cdot\text{power}</math>) of an explosion receive at least 1 damage even when the explosion is fully blocked. The only exceptions are invulnerable entities, Minecraft:Nether stars, and Peaceful players.
The Minecraft:Blast Protection enchantment and the Minecraft:Resistance effect are handled separately.
Calculator
Calculators/Explosion entity influence
Exposure
The exposure is a measurement of how much of the explosion is blocked by blocks. It ranges from 0 (when the explosion is entirely blocked) to 1 (when there are no obstructions).
To calculate the exposure, the game picks a set of sample points in the entity and casts rays from the explosion center to each point.
For each ray, the game checks if it intersects with any block hitbox. If it does, it is considered obstructed. The exposure is then calculated by dividing the number of unobstructed rays by the total number of rays.
Sample points
The sample points are arranged in a <math display="inline">\left\lceil2\cdot\mathsf{width}+1\right\rceil\times\left\lceil2\cdot\mathsf{height}+1\right\rceil\times\left\lceil2\cdot\mathsf{length}+1\right\rceil</math> 3D grid. <math display="inline">\mathsf{width}</math>, <math display="inline">\mathsf{height}</math>, and <math display="inline">\mathsf{length}</math> represent the X, Y, and Z dimension of the entity's bounding box respectively (measured in blocks).
Points on the grid are spaced by
<math display="block">\begin{bmatrix} \frac{\text{width}}{2\cdot\text{width}+1} \\ \frac{\text{height}}{2\cdot\text{height}+1} \\ \frac{\text{length}}{2\cdot\text{length}+1} \end{bmatrix}</math>
With the negative corner at
<math display="block">\begin{bmatrix} \frac{1}{2}\left(1-\frac{\lfloor2\cdot\text{width}+1\rfloor}{2\cdot\text{width}+1}\right) \\ 0 \\ \frac{1}{2}\left(1-\frac{\lfloor2\cdot\text{length}+1\rfloor}{2\cdot\text{length}+1}\right) \end{bmatrix}</math>
Edge cases
- Exposure is directionally biased (and the ray targets can sometimes be outside the entity) due to bug Template:Bug. This mostly affects small entities and entities that are far from a multiple of 0.5 wide.
- The top of Minecraft:scaffolding only obstructs exposure rays if the feet position of the affected entity is above it. This has the effect of explosions appearing to travel down through scaffolding but not up.
- For blocks whose collision box extends outside the full cube containing them (Minecraft:walls, Minecraft:fences, the back of Minecraft:piston arms, Minecraft:moving blocks, etc.), they only obstruct exposure rays if the rays intersect the full cube where the block is located.
Block destruction
On a small scale, explosions form a roughly spherical crater. The size of that crater is dependent on the power of the explosion and the blast resistance of the destroyed blocks.
Calculating which blocks to destroy
To calculate the blocks affected, "rays" are created from the explosion center to the outer points of a 16 by 16 by 16 grid. Each of those rays gets an intensity of <math display="inline">\text{power} \cdot (\text{random value from 0.7 to 1.3})</math>.
For each ray, with the position starting at the explosion center:
- The game checks the block at the current position (this ignores block shape).
- If the block isn't air, intensity is reduced by <math display="inline">(\text{blast resistance} + 0.3) \cdot 0.3</math>.
- If the remaining intensity is above 0 and the block can be blown up, it gets added to the list of blocks to blow up.
- Position is moved 0.3 blocks along the ray.
- Intensity is reduced by
0.22500001. - If the remaining intensity is above 0, repeat from step 1. Otherwise, continue with the next ray.
This typically results in the maximum sphere of block damage having a radius of approximately 4/3 times the explosion power. This can be experimentally verified by repeating an explosion of a set explosion power at some coordinate inside blocks and measuring the radius of the resulting sphere of air.
After the process is done, the list of blocks to blow up is shuffled. For explosions that can cause Minecraft:fires, the game attempts to generate fire in Template:Frac of the blocks in the list. This fire is successfully placed only when above an opaque block.
Due to the fact that the game ignores block shapes when checking blast resistance, explosions happening inside a non-full block get dampened heavily. Sufficiently weak explosions happening on Minecraft:ender chests, Minecraft:enchanting tables, or any height of Minecraft:water or Minecraft:lava don't do block damage.
Dropping blocks
Blocks destroyed by explosions have a chance to drop items as if mined with an unenchanted diamond Minecraft:tool. Blocks destroyed by Minecraft:TNT have a 100% chance of dropping. Other explosions have a Template:Frac chance of dropping items. However, Minecraft:dragon eggs, Minecraft:beacons, Minecraft:conduits, Minecraft:heads, Minecraft:shulker boxes and Minecraft:decorated pots<ref>Template:Bug</ref> always drop from explosions.
The drop chance of blocks in explosions can be customized via three Minecraft:game rules: blockExplosionDropDecayTemplate:Only (includes Minecraft:End crystals), mobExplosionDropDecayTemplate:Only and tntExplosionDropDecay. Only tntExplosionDropDecay is set to false by default. If an explosion's drop decay is set to false, items have a 100% chance of dropping.
Worlds created before 1.21 retain their old tntExplosionDropDecay settings. Upgraded worlds need to use Template:Cmd to get the new behavior.Template:Only<ref>https://bugs.mojang.com/browse/MCPE-56036?focusedId=1331407&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-1331407</ref>
Causes
| Cause | Power | Max. blast resistance | Max. range | Fire | Affected by mobGriefing
|
Notes |
|---|---|---|---|---|---|---|
| Template:EntityLink (Minecraft:ghast projectile) | 1 | 3.49 | Entity: 2 Block: 1.5 |
Template:Tc | Template:Tc | Can have its explosion power modified by editing its Entity data. |
| Template:EntityLink Template:EntityLink |
1 | 3.49 | Entity: 2 Block: 1.5 |
Template:Tc | Template:Tc | Template:EntityLink: Treats blocks breakable in Survival as having ≤ 0.8 blast resistance. |
| Template:EntityLink | 3 | 12.16 | Entity: 6 Block: 5.1 |
Template:Tc | Template:Tc | Can have its explosion power modified by editing its Entity data. |
| Template:BlockLink Template:EntityLink Template:BlockLinkTemplate:Only |
4 | 16.49 | Entity: 8 Block: 6.9 |
Template:Tc | Template:Tc | Template:EntityLink: Gets up to an extra 7.5 explosion power (up to 11.5 total) based on the conditions under which it exploded. Template:BlockLinkTemplate:Only: Ignores water The explosion center is approximately 0.06125 blocks above the TNT's position. |
| Template:BlockLink Template:BlockLink (when used in a wrong dimension) |
5 | 20.83 | Entity: 10 Block: 8.4 |
Template:Tc | Template:Tc | Death message: "(player) was killed by [Intentional Game Design]" |
| Template:EntityLink (when destroyed) | 6 | 25.16 | Entity: 12 Block: 10.2 |
Template:Tc | Template:Tc | |
| Template:EntityLink | 6 | 25.16 | Entity: 12 Block: 10.2 |
Template:Tc | Template:Tc | Drops Minecraft:heads or skulls of Minecraft:mobs killed by explosion.
Can have its explosion power modified by editing its Entity data. |
| Template:EntityLink (when spawned, or when killedTemplate:Only) | 7 | 29.49 | Entity: 14 Block: 12 |
Template:Tc | Template:Tc | |
| Template:EntityLink (half health charge move)Template:Only |
8 | -- | Entity: 16 Block: 13.8 |
Template:Tc | Template:Tc | Breaks any block breakable in Survival (except reinforced deepslate), ignoring blast resistance. |
Despite doing Minecraft:damage to Minecraft:entities, Minecraft:fireworks do not destroy terrain and as such are not counted as conventional explosions.
Minecraft:Lab tables sometimes perform a non-terrain-damaging explosion when creating Minecraft:garbage item.Template:Only
Blast resistance
|
For the {{{Description}}} of the same name, see [[{{{Destination}}}]]. |
The following table shows the blast resistance values used in Minecraft's code for all blocks. In Minecraft:add-on documentation for Template:BE, these values are multiplied by 5 when used for the Template:Cd value in the Template:Cd component. For example, Minecraft:cobblestone has a blast resistance of 6, so to make a custom block with the same blast resistance as cobblestone, quintuple that (which is 30) must be stored in its Template:Cd value.
Sounds
History
Development
Java Edition
Bedrock Edition
Legacy Console Edition
Issues
Trivia
- Explosions with a power greater than 100 look mostly the same from the outside, as only certain lines are used to determine if a Minecraft:block breaks. However, some of those lines continue underground.
- Explosions that occur in flowing Minecraft:water or Minecraft:lava apply propulsion and damage to Minecraft:entities, but don't affect any Minecraft:blocks, regardless of the blocks' blast resistance.
- Underwater explosions don't emit smoke Minecraft:particles.
- Explosions can redirect projectiles, including Minecraft:ender pearls.
- An explosion just after a mob's death can propel the Minecraft:mob's body.
- If a falling sand entity falls into primed TNT when in water, it deals block Minecraft:damage.
References
Minecraft:de:Explosion Minecraft:es:Explosión Minecraft:fr:Explosion Minecraft:it:Esplosione Minecraft:ja:爆発 Minecraft:ko:폭발 Minecraft:nl:Explosie Minecraft:pl:Eksplozja Minecraft:pt:Explosão Minecraft:ru:Взрыв Minecraft:uk:Вибух Minecraft:zh:爆炸