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.

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)

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.

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.

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.

• But my entry portal is at Y120, the exit portal location doesn't make sense at all of that's the case. Sep 14, 2019 at 15:34
• Oh yes, you even wrote that in the question. Then I don't know. This might be a bug. Sep 14, 2019 at 15:37
• The wiki (the one you linked, thank you) says the game looks for a 3x4 space to make a valid spawn. Both the cave and the top satisfy this. Maybe the game just lazily checked the area and probably this is a bug. Thank you for your answer, regardless. Sep 14, 2019 at 15:42
• It's a bit more complicated, but a 1×4 area of completely flat ground with nothing on it definitely is a valid portal spawn location. Sep 14, 2019 at 16:28

Usually, when you create a portal in the Nether, it will compare where you made the portal in the Nether (using the 8-block distance trick everyone knows and loves), and place it in the Overworld. Usually, it will start at Y=0, then keep repeating and checking until it reaches a place that has enough space (kind of like how the game loads the player when you load into a world). This is usually why people load on the surface, because there's almost always a definite chance that there is enough space (because (duh) it's the surface).

Although I'm no coding master, this has been my experience for years. Hopefully, this answers your question.

• One thing I would recommend though is to checkmark which option helped you the most... May 23 at 18:16