Thunderstorm

Thunderstorms are a somewhat uncommon and dangerous weather condition.

Behavior
Thunderstorms are an uncommon temporary, global occurrence that can happen randomly at any time, within the Overworld. The exact type of precipitation during a thunderstorm varies depending on the temperature of the current biome, as well as the current altitude.

Thunderstorms may occur randomly, as rain or snow storms worsen. The average rain lasts 0.5–1 Minecraft day, and there is a 0.5–7.5 day delay between them. The possibility of rain worsening into thunderstorm is quite low.

Thunderstorms can be skipped entirely with the use of a bed, regardless of the time of day. Sleeping in a bed also resets the in-game storm timer, making a storm right after sleeping unlikely. This means the best way to wait for a thunderstorm would be to go without sleeping for several days, as sleeping every Minecraft day would minimize the chance of a thunderstorm occurring.

Effects
As with rain and snow, the sky is darkened and the sun, moon, and stars are no longer visible. Thunderstorms darken the world, causing the light level from the sky to visually decrease to 10. The clouds darken from white to dark gray, although clouds themselves do not precipitate or create lightning. While the sun is not visible during rain, the glow associated with sunrise and sunset is still visible.

Unlike during regular rainstorms or snowstorms, the light level from the sky is treated as if it were 5 for the purposes of hostile mob spawning, which allows hostile mobs to spawn at any time of the day.

Lightning
Lightning is a lethal element to thunderstorms. Lightning momentarily increases the sky light's brightness to slightly greater than full daylight.



Lightning strikes randomly and creates fires (only on normal and hard difficulty) in a 2 block radius where it strikes. Such fires act normally, igniting all flammable materials, detonating TNT, and even activating nether portals. The lightning itself, however, is not destructive and does not destroy blocks. While most fires are extinguished by the rain, areas that block rain can allow the fire to spread, and any netherrack, soul sand, or soul soil lit by lightning is not extinguished by the rain.

Most entities struck by lightning are dealt damage (sometimes twice in succession) and are set on fire, which may cause additional damage.

If the player is killed by a lightning strike, the death message appears: " was struck by lightning." This message does not display if the player was killed by the fire created by a lightning bolt.

Lightning may be manually summoned with the command. It is summoned as an entity, and it can be referred to by commands or selectors.



Lightning is also spawned when a trident enchanted with Channeling is thrown and strikes a mob during a thunderstorm.

Effects on mobs
A lightning strike affects certain mobs differently:
 * Lightning may randomly spawn a "Skeleton Trap" Horse with a chance of 0.75–1.5% chance on Easy, 1.5–4% on Normal, and 2.8125–6.75% on Hard, depending on the regional difficulty. A player triggers the trap by moving within 10 blocks of the horse, whereupon the horse transforms into four skeletal horsemen. A non-triggered trap horse despawns after 15 minutes.
 * A pig struck by lightning turns into a zombified piglin.
 * A creeper becomes charged.
 * A villager gets replaced by a witch.
 * A red mooshroom changes into a brown mooshroom and vice versa.
 * If lightning kills a turtle, it drops 1 bowl instead of its normal drops.
 * Regardless of current health, lightning always instantly kills turtles.

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

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 obstructs movement is chosen for the lightning strike. Then if there are any living entities that can see the sky in a 3×h×3 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 the sky.
 * Rain (not snow) is falling in the target block.
 * Thus, lightning does not naturally strike within cold biomes or biomes where it does not rain (except in the Console Edition).

When lightning strikes, all entities within a 6×12×6 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. Non-solid blocks (such as redstone, torches, and snow layers) are not directly affected by lightning.

Thunder
Thunder is a sound event that occurs every time lightning strikes. Every player within 160 thousand blocks and the same dimension hears the thunder.

The ability to hear thunder affects multiplayer, as it is possible to hear lightning strike at someone else's base or use a modded Minecraft client to determine the direction of every strike in the world the player is in. Using the direction of strikes, it is possible to triangulate the coordinates of lightning strikes.

Lightning Rods
Lightning strikes within an area of 32×4×32 blocks above a Lightning Rod will be redirected to the rod, emitting a Redstone signal. This can be used to prevent flammable structures from being struck by lightning, or intentionally direct lightning towards mobs.

ID




Entity data
Lightning bolts have entity data associated with them that contain various properties.

Trivia

 * Lightning, unlike other weather effects, does not have an image file associated with it. Thus, it is coded directly into the game engine, allowing for dynamic, realistic lightning.
 * $$, lightning strikes closer to the player more often than in Java Edition, due to spawn distance limits.