My nether portal spawned inside of a cave?

I am making/placing portals in the nether every 125 blocks so I have a checkpoint of portals every 1000 blocks in the overworld.

The Y axis of my portal are is at 120, like in the screenshot below.Picture of my portal in the nether

Now, when I entered that portal, it spawned me inside of the cave. (the screenshot shows no portal on it since I removed it, but the obsidian is the original location of the spawned portal) Spawn area of the exit portal

I decided to dig straight up and try to look for a reason why I spawned in the cave and I'm just seeing an area that is perfectly fine for a portal to spawn in.

The surface above the portal I spawned in

My question is why did the game decided to spawn a portal in a cave? Are there some checks that the game does? All I know is if it has a space for it, it goes there.

If it matters, the game version I'm running on is 1.14.4.


Solution 1:

Nether portals prefer generating on the same height as in the other dimension. So if you create your portal below y=64 in the Nether, it is likely to be generated in a cave in the Overworld.

The closest valid position in 3D distance is always picked.

– Minecraft wiki (archive)