Ruined Portal

A ruined portal is a naturally generated damaged nether portal, which spawns in both the Nether and the Overworld.

Generation
Ruined portals generate in all biomes in both the Nether and the Overworld. They can spawn underground, underwater, or exposed to the air. If they generate underground, they have air pockets around them. Natural terrain around ruined portals generates as netherrack. They also generate a mass of netherrack underneath them. Giant ruined portals have 3 distinct designs, and normal ruined portals have 10 designs. When a ruined portal generates, it has a 5% chance to be a giant ruined portal, for about a 1.67% chance per giant portal design. This gives normal ruined portals a 95% chance, for a 9.5% chance per normal ruined portal design.

Ruined portals that generate underground do so at Y-level from 15 to, where is the highest block at the point of generation and  is the height of the ruined portal structure. This means the terrain is always higher than or level with the top of the structure.

Ruined portals that generate in mountains generate at y-level from 70 to.

Ruined portals that generate partially buried do so at y-level, plus a random integer from 2 to 8. This means that the structure has 2 to 8 layers raised above the surface.

In the Nether, ruined portals with air pockets generate from Y-level 32 to 100. Ruined portals without air pockets have a 50% chance to spawn from Y-level 27 to 29, and a 50% chance to spawn from Y-level 29 to 100.

Many blocks in ruined portals are replaced upon generation. A ruined portal is in a "cold" biome if the temperature is less than 0.15.

Structure
Ruined portals generate incomplete portal frames composed of both obsidian and crying obsidian, despite crying obsidian not being a valid portal material (likely to give the portals an "aged" appearance). Some frames generate flat on the ground, as if they toppled over.

All ruined portals should generate with a chest, which contain various golden items and items used to build portals such as obsidian and flint and steel. However, before 20w27a, some chests were missing.

Any ruined portal generated in the Overworld is surrounded with structures made of stone, stone bricks, and iron bars; in the Nether it is surrounded by blackstone variants and chains.

Currently there are 13 variants: 10 normal size portals and 3 giant portals in varying states of decay.

$$, ruined portals can be generated by the player by loading or  with a structure block. These ruined portals generate as stored, meaning they are not modified as detailed in the Generation section above.

Portals
Note that some blocks are replaced with others upon generation. A full list can be seen above.

Trivia

 * Using the partially buried generation, some ruined portal variants are short enough that they can generate completely on the surface.
 * Ruined portals are the only generated structure that can be found in more than one dimension.
 * All basic ruined portal structures contain enough obsidian to make a complete portal. However, there is often not enough in natural ruined portals as some obsidian is replaced with crying obsidian.
 * Due to generating with magma blocks, underwater ruined portals create downward bubble columns.