Cave

Caves (also known as caverns) are commonly-found underground structures generated in the Overworld and, to a lesser extent, the Nether.

Generation
Caves are underground structures consisting of randomly generated patches of air blocks and lava source blocks (at layer 10 and below), hollowing out an area and exposing other blocks generated with the terrain (such as stones and mineral veins) in the interior. Their structure typically consists of a series of irregular tunnels branching off and winding in other directions, which may connect to the surface, creating natural entrances to the cave. In jungle biomes, vines generate in caves near the surface. Sand often falls into caves generated near the surface of a desert or beach; craters in the sand can alert the player to caves below the surface. Caves cannot cut through red sand nor snow blocks, despite these generating as a surface block in several biomes.

Caves generate at any altitude up to Y-level 129, and may span from the surface all the way to bedrock (Y-level 5). They frequently intersect natural structures such as other caves, dungeons, ravines, and mineshafts. Because of low light levels, hostile mobs and bats often spawn in caves deep underground.

Caves and ravines are able to generate underwater.

Structure
A cave can be classified into the following kinds of cave systems.

Hollow


Hollows are cave-like structures that generate in biomes such as mountains and shattered savannah. They may sometimes intersect with and open into larger cave systems. These are extremely rare on default worlds without customized world option and usually have floors corresponding to the biome (most commonly grass). They are ordinarily of little impact to gameplay, as they rarely contain anything of value beyond iron and coal.

Small cave


Small caves are primarily located close to sea level and are unlikely to be linked to other caves. Because of their relative shallowness, they are unlikely to contain anything rarer than small deposits of basic ores such as coal and iron. Such caves may have multiple entrances that are naturally lit by sunlight or moonlight. These type of caves almost always feature pools of water/lava within, likely caused by the generation of the water itself.

Medium cave


Medium-sized cave systems are commonly found within reach of other, often smaller caves, which are accessible via mining. These caves frequently contain large deposits of basic ores alongside small repositories of rarer materials. Such caves also regularly contain, at the very least, minor water or lava flows as well as the presence of dungeons.

Large cave


These are large subterranean systems, found deep within the overworld, often close to bedrock. They hold large deposits of essentially every known type of ore - with rarer materials, such as diamonds and emeralds. Note that emerald ore is exclusively generated in mountains biomes. Such systems contain a number of lakes of all types, as well as the presence of major lava and water flows.

There is little to no difference between small, medium, and large caves other than their size and complexity.

Cylindrical cave


During the terrain generation process, large symmetrical and cylindrical caves of various sizes can infrequently be created underground, which often merge with other cave systems. These unusual type of caves vary from roughly 1 to 27 blocks in height, and from roughly 13 to 30 blocks in diameter, though larger examples are quite rare. Although not particularly of interest, from a mining perspective, they may appear unnaturally regular in comparison to the surrounding terrain. While the smallest rarely contain many ores, the largest can be quite useful for mining as their sheer surface area rivals that of a large ravine.

Very rarely, dungeons or strongholds can be found in these rooms.

Ravine
Ravines are tall, long cracks of air, usually measuring around 27 to 62 blocks in height, 85 to 127 blocks long and typically less than 15 blocks wide. Ravines can have small ledges along the top. They can be found at levels 10 to 72, sometimes appearing on the world surface or underwater, forming canyons. They can go very deep underground, sometimes spawning slimes or exposing diamond ore. If they reach deep enough, they may also be floored by the lava lakes at level 11. Ravines can cut from surface level all the way down to bedrock, especially noticeable in the Amplified world type. Ravines can also be found in oceans or rivers having a waterfall from the river/ocean falling into them. Ravines can spawn in the ocean with magma blocks at the bottom forming bubble columns.

Ravines can connect to caves, dungeons, abandoned mineshafts, and any other generated structures. Due to the large surface area of their walls, ravines often have water and/or lava flowing down them (from springs in the walls, underground lakes, or openings to the sea). A ravine that intersects a river or frozen river cuts off the river with walls of stone to accommodate the ravine.

$$, ravines almost always go all the way down to bedrock, which causes lava to generate at the bottom. This means ravines spawning in mountain biomes appear larger. Obsidian often forms at the bottom as water sources flow down into the lava. Because ravines reach below Y coordinate 15, it is possible to find diamonds near the bottom.

Deep pit


These caves have a large hole for an entrance and then spiral down, often cutting into coal and iron deposits. Sometimes, these entrances can go nearly straight down, exposing rarer minerals.

Connected cavern


Connected caverns are large, spacious caverns that is usually the result when multiple small caves merge with each other creating a large, messy, single cave. They are similar to large caves except more messy and spacious, with different layers. These connected caverns usually have waterfalls or lavafalls coming out of the cave ceiling, sometimes even both. They also have different "floor layers", meaning the cave has different stone layers that can be accessed to each other in the same connected cavern, simply by stacking up blocks. Connected caves usually have two to four layers. Usually, small regular cave systems nearby eventually connect to a connected cavern. Caves may connect to a connected cavern from any direction, including from above. Connected caverns are not significantly rare, but can still prove to be a small challenge to find.

Sea-access cave


These caves are connected with and are accessed from the sea. These are fundamentally underwater entrances to caves, and are more often large ravines than actual caves. When lit by magma blocks, they allow the Player to see them from the surface of the ocean.

Since caves usually generate specifically to avoid water, true sea-access caves are rare and most are formed by gravity blocks collapsing inside.

Water lakes


Found in every part of the world, underground water lakes are the most common type of lake. Water lakes may generate 1-20 blocks below the surface, are often visible from the surface and not particularly difficult to come across, and can generate all the way to bedrock level.

Lava lakes
These are similar to water lakes, and can generate at all layers. Blocks of stone usually generate around these.

Lava oceans


Similarly to how water oceans replace all air blocks below a certain altitude on the surface, when deep enough in a cave, all blocks that would generate as air instead generate as lava.

Trivia

 * Caves often intersect other generated structures.
 * In deserts, husks spawn in caves because zombies do not spawn commonly in the desert.