There's a rumour that passive mobs (pigs, cows, sheep) can only spawn on the highest solid block. In other words, they won't spawn on grass with a solid block roof over it, such as in an underground cave, a player-built barn, or a glass dome.
Is this true, as of Minecraft 1.0?
Best Answer
I'm no expert at Java, so this isn't a decisive answer, but I figure it can't hurt to post the code here anyway for others to decipher. From
SpawnerAnimals.java
:(Comments mine)
It does not appear that it checks whether the mob is spawning underground or not.
Anecdotally, wandering around for a while with an Xray texture pack produced only surface mobs, so I'm not sure what other guards might be put in place to prevent underground spawns.