Forum: gaming.stackexchange.com
Tags: <minecraft-java-edition>
Title: How does animal spawning work?
Question: In what way do animals in Minecraft spawn? It looks to me that they spawn more during the night (but where there are torches) and more kind of around you / around some other human player. Am I right, or does it work some other way?  Thank you.

Answers:
sents: text: Prior to version 1.6, all ground passive mobs (not squid) will spawn at light level 9 or above on grass blocks.
text: From version 1.6 onwards they will spawn on grass at any light level.
text: Squid will spawn at any light level under water.
text: Groups:
text: Pigs spawn in groups of 3-4 Sheep spawn in groups of 2-8 Cows spawn in groups of 4-12 Chickens spawn in groups of 1-3 (and a 1/8th chance from a thrown egg)
answer_details: author: gaming.stackexchange.com/users/4012/Ronan
score: 13
sents: text: The Minecraft Wiki shows that there are many variables that affect animal spawnings as of version 1.3.2.
text: One in ten newly generated chunks will contain mobs (includes any animal, monster, or utility).
text: They can show up in as many as four 'packs' of the same mob.
text: They will always spawn on the highest point (the blocks that you see if you were flying).
text: Therefore, if the world generator had to choose between spawning an animal on a ledge or inside a cave, it would choose the ledge.
text: The block that the animal spawns on must be opaque (not glass, water, lava, etc).
text: Pigs spawn in groups of either three or four.
text: Sheep spawn in groups of two to eight.
text: Cows spawn in groups of four, and can spawn up to twelve.
text: Chickens spawn in groups of as much as three.
text: When chicken eggs are thrown, there is a 1/8 chance of a baby chicken spawning.
text: There is also a 1/32 chance of four spawning instead of one.
text: Before version 1.6, they only spawned when the light level was over nine, now they spawn regardless of whatever light level.
text: The block two blocks above the opaque block must be non-opaque (tree leaf, water, lava, glass).
text: Animals (excluding squid) do not spawn in ocean biomes.
text: No animals normally spawn in desert biomes.
text: The spawning of animals is dependent on the world seed .
text: This means that if I make a world with default settings and the seed 'minecraft' and you do that same, the cows and pigs will spawn in the exact same places.
text: Very rarely, new animals can spawn in already generated chunks, like monsters.
text: When this happens, as well as when mobs spawn from a mob spawner, the following rules apply: The light level must be nine or more.
text: The opaque must be a grass block (not a dirt block).
text: Unlike monsters, animals do not spontaneously despawn, except for wild ocelots and wolves (which can despawn only when they are hostile).
text: They do not despawn even if the player is far from them.
text: Note that squids have different spawning criteria then other mobs.
text: They can spawn at any light level underwater.
text: They will also spawn in player made pools and sometimes they will spawn in underground water deposits.
text: It is technically possible for them to spawn in one block of water, but that is not very likely.
answer_details: author: gaming.stackexchange.com/users/None/
score: 11
sents: text: In Addition: Animals, and Monster-Mobs too, ONLY Spawn a few 100 blocks around human Players.
text: Animals only Spawn on dirt blocks and cobble stone
answer_details: author: gaming.stackexchange.com/users/6345/WeGi
score: 5
sents: text: The wiki has a good overview, but the key points are as follows: Passive mobs don't despawn when they are far from the player, except for angered wolves and ocelots (which by definition are not passive).
text: Passive mobs are spawned on chunks that have just been generated.
text: They spawn above the highest opaque block that has at least 2 transparent blocks above it.
text: Passive mobs also have the chance to spawn on existing chunks, but at a much reduced rate compared to hostile mobs.
text: Passive mobs need a light level of at least 9 and a grass block to spawn in this manner.
text: Animals other than squids will not spawn in ocean and desert.
text: Obviously, squids only spawn in water, which generally means ocean.
answer_details: author: gaming.stackexchange.com/users/1351/MBraedley
score: 3
sents: text: I learned that squid can spawn only in water, but it will take about 5-10 days (in the game).
text: Squid can spawn in even 1 block of water.
answer_details: author: gaming.stackexchange.com/users/36120/jessiem
score: 3
sents: text: Animal spawning is always slowly changing.
text: Clarify some points: Animals will not spawn in the spawn chunk (where you spawned)
text: Animals will not spawn within 16 blocks of a player - Monsters will not spawn within 22 blocks of a player, but once they move closer than 22 blocks to the player they cannot despawn.
text: Nothing will spawn further than 128 blocks from the player.
text: Despawning varies depending on the mob.
text: Monsters despawn instantly if they spawn more than 82 blocks from the player.
text: This is all SPHERICAL - meaning in the caves below you, platforms above you,and in any direction.
text: As of 1.13 squid only spawn in river & ocean bioms between levels 62 and 46.
text: (however, I was unable to build a working squid farm in a mushroom island biom in 1.12.2)
text: Before 1.13 they can spawn in any water, 1 block or larger, between levels 46 and 64.
text: There is a mob cap, a maximum limit that can be in range of the player.
text: Once that cap is reached more mobs will not spawn, friendly, neutral or hostile.
text: Each has it's own cap not affected by the other.
text: HOWEVER, placing animals in pens or naming them takes them out of the cap count, and so does killing them, obviously.
text: You can breed as many food mobs as you want (see Mumbo's chicken farm in season 4 of Hermitcraft) and they will never despawn if penned, named, or otherwise enclosed.
text: Hostile mobs can only spawn in light of 7 or less.
text: Once spawned, all hostile mobs can survive in any artificial light of any level (torches, lanterns, etc..)
text: Fun Fact: Hostile mobs can spawn any time day or night on blocks placed at level 256 because technically there is no light above 256 to light the top surface.
text: So in short the OP was correct that spawning was centered around a player.
text: Verification of this information can be done in the official wiki or watching Let's Play videos for Skyblock Challenge.
answer_details: author: gaming.stackexchange.com/users/241659/Dave Sunhammer
score: 0

Summary of the answers:
All ground passive mobs with spawn on grass at any light level. Squid can spawn in water, in 5-10 days.
While in the past passive mobs spawned at light level 9 and above, now the spawn on grass whatever the light level. Squids spawn in water and all animals spawn within a few 100 blocks around the player.