Thunderstorm



A thunderstorm is a fairly uncommon weather condition which takes place randomly during rain or snowfall.

Effects

 * Light level falls to 10 during daytime. Like rain, thunderstorms won't reduce the light level below 4 at night.
 * When spawning hostile mobs, the light level from the sky is treated as if it were 5.
 * The Sun, Moon and stars become obscured.
 * The player can sleep in a bed during a thunderstorm, regardless of the time of day.
 * Blazes, endermen, and snow golems are harmed by the rain.

Lightning
Lightning is a lethal element to the storm. It strikes randomly across the world, creating brief fires. While most are immediately put out by the rain, it is possible for it to ignite wood and other flammable blocks.
 * Lightning creates fire where it strikes. While the accompanying rain usually puts out the fires before they spread, overhangs that block rain can allow fire spread. Netherrack lit by lightning will not be extinguished by rain.
 * Thunder can be heard by the player up to 160,000 blocks away from where the lightning strikes, but it can only strike in loaded chunks. In multiplayer, lightning can strike in chunks that are farther away because other players can load the chunks.
 * Lightning will light up the sky and the world of any player within a 512 block radius. This does not affect shadows caused by blocks.
 * Partial blocks (such as redstone, torches, and snow cover) are not directly affected by lightning.
 * Most entities struck by lightning are dealt damage, and are set on fire which may cause additional damage.
 * If lightning strikes a pig, it turns into a zombie pigman.
 * If lightning strikes a creeper, it becomes charged.
 * If lightning strikes a villager, it transforms into a witch.
 * Items dropped during the lightning strike will frequently be destroyed by lightning.
 * Lightning will sometimes spawn a "skeleton trap" skeletal horse. Chance is 3.75–7.5% on Easy, 7.5–20% on Normal, and 11.25–33.75% on Hard, depending on regional difficulty.

Lightning mechanics
For each loaded chunk, every tick there is a $1/100,000$ chance of an attempted lightning strike while it is thunderstorming.

When lightning is to strike, random X and Z coordinates within the chunk are chosen, and the block just above the highest block that is liquid or blocks movement is chosen for the lightning strike. Then if there are any living entities that can see the sky in a 3×3×h region from 3 below the target block up to the world height, one such entity is selected at random and the lightning target is moved to the block the entity is standing in.

The target block is checked again for the following conditions: If these conditions pass, lightning strikes.
 * Target block can see sky.
 * Rain (not snow) is falling in the target block.

When lightning strikes, all entities within a 6×6×12 region horizontally centered on the northwest corner of the target block with the bottom edge 3 below the target block are struck by lightning. Multiple passes are made over this region, so items dropped during an earlier pass may be destroyed during a subsequent pass; damage immunity usually prevents struck mobs from taking more than damage.

Spawning
Lightning can be spawned via the command. This will summon a lightning bolt to the current position of the Player. This makes it seem as if the lightning is an entity although it can not be referred to by any other commands. Using this command makes lightning behave differently than to how it acts naturally, as it only flashes once and it allows lightning to be stopped by air blocks.

Trivia

 * If lightning strikes near a Nether portal frame, the fire produced may activate the portal.
 * If lightning strikes TNT, it will detonate.
 * Lightning only strikes blocks being rained on, and thus will not strike in dry or snowy biomes, except desert biomes in console edition.
 * The rules for choosing an entity to move the lightning target to are more lenient than the rules for lightning to actually strike. Entities under blocks that stop rain but do not obstruct the view of the sky (e.g. trapdoors, glass) or standing in water can prevent lightning strikes in the immediate vicinity.
 * As long as the player is within earshot (with a very long range), thunder will be heard at the same time as lightning strikes.
 * On the Pocket Edition, If the player leaves the world during a thunderstorm and rejoins, it would only be raining.
 * Thunder can be heard all the way down to the bedrock layer, even in the Void. Like ambience, thunder is not an indicator of anything but areas that were struck by lightning.
 * If the player is killed by a lightning strike, the death message will read [player] was struck by lightning. However, this will not work if the player is killed by the fire created by a lightning bolt.
 * Lightning, unlike other weather, does not have an image file associated with it. Thus, it is coded directly into the game engine, allowing for dynamic, realistic lightning.
 * On the Pocket Edition, lightning strikes closer to the player more often than the PC and Console Version, due to spawn distance limits.
 * Forest fires made by lightning are rare unless the lightning strikes underneath a tree, where the rain would not be able to extinguish the fire.
 * If multiple lightning bolts strike a single villager at the same time, the number of witches spawned as a result is equal to the number of lightning bolts, making it possible, but ridiculously unlikely, to get multiple witches from one villager. This also works with pig-to-pigman transformations, but not creeper-to-charged transformations as the latter is just a change of state rather than a new entity creation.
 * You cannot see mobs, water, glass, etc., through lightning.