Spawn

From Minecraft Wiki
Jump to: navigation, search
"Respawn" redirects here. For the block to set a spawn point in the Nether, see Respawn Anchor.
This article is about the natural spawning of mobs. For other uses, see Spawn (disambiguation).
Clock JE2 BE2.gif
This article needs to be updated.
The reason given is: A comprehensive check that this article is up-to-date from 1.9 to 1.16 is in order.
Please update this article to reflect recent updates or newly available information.
Cleanup.svg
This article may need cleanup to comply with the style guide. [discuss]
Please help the Minecraft Wiki clean up this page if you can.
The talk page may contain suggestions.

Spawning refers to players and mobs being created and placed in the Minecraft world.

Player spawning[edit]

World Spawn[edit]

World spawning area. White represents the extent of singleplayer, blue represents multiplayer, and yellow represents the world spawn point.

New players initially spawn within a small area surrounding the world spawn point when the server is not in Adventure mode. This area is 21×21 blocks by default, but can be changed by the spawnRadius gamerule in both single and multiplayer. Upon death, the player respawns within this area unless the player's individual spawn point changed (by sleeping in a bed or using a respawn anchor). In addition, the player spawns only on grass blocks in the world spawn area.

When the player loads into the world or respawns, the game searches within the world spawn area and places the player on a grass block. Any non-solid such as string, carpet, and flowers that are placed directly above a grass block causes the block to become a invalid spawn point. However, if all grass blocks are removed or have non-solid blocks, the player spawns directly in the center of the 21×21 area.

Upon spawning, the player is placed on the highest block of the X and Z spawn coordinates, even if this would set the player above the maximum build height. This area does not consider the existence of a block on which to spawn, and this can result in players spawning above the Void if there are no blocks at that X and Z location.

The world spawn point also determines the center of the permanently loaded spawn chunks.

The world spawn point itself can be changed using the /setworldspawn command.

Bedrock World Spawn Search[edit]

In Bedrock Edition, when a player creates a new world, the world spawn point is restricted to specific biomes. The algorithm starts searching from coordinate 0,0, continuing outward until an acceptable biome is found for the world spawn point. Using add-ons, a rare biome can be designated to cause the player to spawn at a distant location, but the game crashes if the biome does not exist or cannot generate.

The algorithm searches for these biomes:

The player spawns within a 5-block radius of the point selected in the chosen biome, sometimes resulting in the player spawning outside the intended spawn biome, ending up in a beach, river, or swamp biome.

A search for a valid world spawn biome is not performed for Flat and Old world-types.

Adventure mode[edit]

When the server's settings specify the default game mode as Adventure (using the server.properties), then the normal spawning mechanic is ignored, and players are spawned directly on the world spawn point. This includes the X, Y, and Z coordinates, even if there is no block there, and even if there are blocks above it.

If the Y coordinate is not within a valid spawning area, then the server looks up until it finds one, up to a maximum of Y=256. If there is space to spawn, but it is in mid-air, the player spawns in mid-air, even falling into the Void if there is a hole.

Location[edit]

There are several ways to determine the world spawn point:

  • A compass (that hasn't been assigned to a lodestone) always points to the world spawn point.
  • Doing the commands /gamerule spawnRadius 0 then /kill.
  • Entities, other than players, falling into the exit portal in the End land on the exact spawn point. Items thrown in mark the spot in the Overworld. Players spawn like they normally do, allowing this action to be used to perform the above without dying.
  • Mods or external programs, such as NBTExplorer or MCEdit, can also be used to find and set the world spawn point.

Individual spawn[edit]

The individual spawn point of the player can be changed by sleeping in a bed, using a respawn anchor, or using the /spawnpoint command. If the individual spawning area of the player is obstructed upon death, the player respawns at the world spawn.

Sleeping in a bed allows for leniency in obstruction, in that the player respawns on other blocks near the bed if the original point becomes blocked. The same is true for the respawn anchor. If the spawn point set via /spawnpoint becomes obstructed, the player is not given this leniency in respawning.

Natural Generation[edit]

Many mobs generate upon initial chunk creation. These spawns occur only once per chunk. They are not affected by the /gamerule doMobSpawning command.

Animals[edit]

A cow that generated with the map inside a tree's leaves and could not escape, a common sight in forested hill areas.

Approximately one in ten newly-generated chunks contain mobs, usually in packs of up to four of the same species. They always spawn on the highest available block in a column. For an animal to spawn on it, this block must be opaque and the two blocks above it must be transparent. The block does not need to be a grass block nor does it need to be illuminated as it does with mob spawning.

There are 2 types of animals: Common Animals and Biome-specific Animals.

Common Animals

Common animal mobs do not spawn in desert, badlands, beach, snowy tundra, river, ocean, or mushroom fields biomes. The weight is the spawn rate for the Bedrock Codebase [more information needed].

  • Sheep
    • Weight: 6, 2-3 animals
  • Chicken
    • Weight: 5, 2-4 animals
  • Pig
    • Weight: 5, 1-3 animals
  • Cow
    • Weight: 4, 2-3 animals
Biome-specific Animals

Some animal mobs spawn only in specific biomes.[more information needed][verify]

Mobs Biome Weight
Rabbit Desert

Taiga
Giant Tree Taiga[JE only]
Snowy Taiga
Snowy Tundra (all variants)
Frozen Ocean
Frozen River
Snowy Beach
Legacy Frozen Ocean[BE only]
Flower Forest

125 (15 in flower forests)
Red Mooshroom Mushroom Fields

Mushroom Field Shore

810
Polar Bear Snowy Tundra

Frozen Ocean
Frozen River

110 (510 in Frozen Oceans)
Panda Jungle[BE only]

Bamboo Jungle

410 (110 in regular jungles)
Fox Taiga

Snowy Taiga
Giant Tree Taiga

810
Llama Savanna

Mountains

810 (510 in mountains)
Horse Savanna

Plains

410 (110 in savannas)
Donkey Plains

Savanna

240 (140 in savannas)
Parrot

Ocelot

Jungle (all variants) 410 for parrots, 310 for ocelots
Wolf Taiga

Snowy Taiga
Giant Tree Taiga
Forest

810 (510 in forests)
Turtle Beach 810
Dolphin Ocean

Warm Ocean
Lukewarm Ocean
Cold Ocean

710
Cod Ocean

Lukewarm Ocean
Cold Ocean
Frozen Ocean[BE only]

75100
Squid Ocean

River
Beach

810
Salmon River

Cold Ocean
Frozen Ocean
Lukewarm Ocean[BE only]

26100 in oceans, 16100 in rivers
Pufferfish

Tropical Fish

Warm Ocean

Lukewarm Ocean[JE only]
Deep Lukewarm Ocean[JE only]

25100
Hoglin[BE only] Crimson Forest

Randomness for animal spawning is derived from the world seed, which means that worlds with the same seed always generate chunks with the same animals in the same places.

Monsters[edit]

Most monsters cannot spawn on Peaceful difficulty. At higher difficulty, most of them prevent the player from sleeping, and most of them spawn at light level of 7 or less.

Common Monsters

Common monster mobs can spawn in almost any biome in the Overworld (except for mushroom fields). They can spawn on the surface and underground. The weight is the spawn rate in the Bedrock Codebase.

  • zombie
    • Weight: 100, in groups of 2-4
  • creeper
    • Weight: 100, individually
  • spider
    • Weight: 100, individually
  • skeleton
    • Weight: 80, in groups of 1-2
  • enderman
    • Weight: 10, in groups of 1-2
  • witch
    • Weight: 5, individually
Biome-specific Monster[more information needed]

Some monsters spawn only in specific biomes.

Mobs Biome
drowned ocean(all variants)

river(all variants)

husk desert(all variants)
slime swamp
stray snowy tundra

snowy mountains
ice spikes
frozen river
frozen ocean(all variants)

magma cube Nether wastes

Basalt Deltas

piglin
zombified piglin
Nether wastes

Crimson Forest

hoglin[JE only] Crimson Forest
ghast Nether wastes

Soul sand valley
Basalt Deltas

strider Nether wastes

Crimson Forest
Soul sand valley
Basalt Deltas
Warped Forest

Other mobs[edit]

These mobs still spawn if the /gamerule doMobSpawning command is set to false, because they spawn as part of structure generation.

Spawn Cycle[edit]

Java Edition[edit]

Mobs are broadly divided into five categories: hostile, friendly, water creature (e.g. squid), water ambient (e.g. fish), and ambient (e.g. bat). Hostile mobs have a spawning cycle once every game tick (120 of a second). Friendly and water mobs have only one spawning cycle every 400 game ticks). Because of this, where conditions permit spawning, hostile mobs spawn frequently, but passive mobs (ie: animals) spawn rarely. Most animals spawn within chunks when they are generated.

Mobs spawn naturally within a square group of chunks centered on the player, 15×15 chunks (240×240 blocks). When there are multiple players, mobs can spawn within the given distance of any of them. However, hostile mobs (and some others) that move farther than 128 blocks from the nearest player despawn instantly, so the mob spawning area is more-or-less limited to spheres with a radius of 128 blocks, centered at each player. In multiplayer, mob caps are shared by all players, no matter where they are.

Every 24000 ticks (20 minutes) the game attempts to spawn a single wandering trader with two leashed llamas within 48 blocks of a player or at a village meeting place, if no wandering trader exists in the world. The trader does not spawn when the player is underground.‌‌[Java Edition only]

Java Edition Mob Cap[edit]

This section needs expansion with:
The new charge/cost/energy system used for Soul Sand Valleys and Warped Forests. Each mob has a cost for spawning and deducts it from the biome's total energy. Is it reduced per entity spawn or per pack spawn? How does energy recharge? Etc. See Biome.java, NaturalSpawner.java, and PotentialCalculator.java..
You can help by adding to it.

Mob caps are directly proportional to the total number of chunks eligible for spawning. To calculate the cap, the spawning area is expanded by one chunk in every direction (so the default gives 17×17 chunks), then the total number of chunks is plugged into the following formula:

mobCap = constant × chunks ÷ 289

The constants for each group are as follows:

  • Monster = 70
  • Creature = 10
  • Ambient (bats) = 15
  • Water creature (squid, dolphins) = 5
  • Water ambient (fish) = 20
  • Misc = -1

The "misc" category is used only by entities that are not mobs, do not spawn naturally, and/or following different spawning rules than other mobs. As such the mob cap has no bearing on mobs of this category.

In singleplayer, there are always 289 chunks in range, so the constant is always used as the global mobcap.

In multiplayer, the global mobcap grows as more chunks are loaded. As chunks that are in the range of multiple players are counted only once, more chunks and higher mob caps result from the players spreading out more.

The number of mobs is checked once per each chunk against the cap. If the number of mobs (dead or alive) in a category is at its cap, the entire spawning cycle for that category is skipped. The area checked for mobs is the same as the area used for calculating the mobcap, which is the spawning area expanded by one chunk in every direction. The mobcap count is separate for each dimension.

Every chunk, the game checks the mobcap. As such, you can reach mobcap+pack size from natural spawns.

When gamerule spectatorsgeneratechunks is false, spectators do not raise mobcap.

Pack Spawning[edit]

Example of a mob pack spawning. The 41×1×41 spawning area is shaded blue (not to scale). The yellow figures represent the actual positions that mobs could spawn in after checking the environment. Note that the mobs can spawn inside torch and ladder blocks. But they can't spawn on top of glass because it is not opaque. The red cube is the center of the pack.
Requirements for the spawning location of individual mobs.

For each spawning cycle, attempts are made to spawn packs of mobs per each eligible chunk. An eligible chunk is determined by the same check for which chunks are random ticked. A random location in the chunk is chosen to be the center point of the pack. If the block on which a pack spawn occurs is an opaque full cube, further pack spawn attempts are canceled.

The pack is spawned within a 41×1×41 (that's a 41×41 square that is one block high) area centered at the initial block. Mobs spawn with the lowest part of their body inside this area. For each spawn attempt, from the location of the previous attempt, a location up to 4 blocks away from the previous attempt is chosen at random. Thus, the spawns are heavily skewed toward the center of the pack. Approximately 85% of spawns are within 5 blocks of the pack center, and 99% within 10 blocks of the center. If the pack spawn enters a biome different from the starting biome, the rest of the pack and that spawn are canceled.

All mobs within a pack are the same species. The species for the entire pack is chosen randomly, but based on a weight system from those eligible to spawn at the location of the first spawn attempt in the pack.

The game checks on each spawn if the number of mobs that have been spawned for the pack is equal to the max spawn attempts, as well as the location's spawn potential.

Pack Spawn Sizes:

Pack spawn attempts max out at:

  • 8 Wolves, cod, and tropical fish
  • 6 Horses and Donkeys
  • 1 Ghast
  • 4 for any other mob

When the max pack size is less than the number of possible spawn attempts, some spawns attempts fail, but are seen more commonly in practice. Based on the number of mobs that have been successfully spawned. If the max pack size is greater than the number of spawn attempts, one gets only the number of spawns from the spawn attempts. Some mobs have a minimum and max pack size, meaning there is an even chance for any number of spawn attempts between them occurring.

Where Pack Spawns Occur:

For all dimensions, structure-based spawns take priority over biome for hostile spawns. This means that in a swamp hut, pillager outpost, nether fortress (outer bounding box only when there is nether brick below it), and ocean monument, one sees only the corresponding hostile mobs for that structure within that structure.

In the Overworld, this depends on the location:

In the Nether:

Spawn Conditions[edit]

Whether a spawn condition fails differs from the above determination if the game tries to spawn them in that biome. For example, dolphins can have pack spawns that occur inside of frozen ocean and deep frozen ocean biomes, but no other biomes. These rules apply to variants of the same mob, such as baby zombies and spider jockeys.

Each individual spawn attempt succeeds only if all of the following conditions are met:

  • There must be no players or the world spawn point within a 24 radius block distance (spherical) of the spawning block
  • The number of loaded mobs of that type must be less than the mob cap for that type. (I.e. the corresponding mobcap must not be full)
  • The mob's collision box upon spawning must not collide with another collision box. A mob cannot spawn inside of anything that would collide with it upon spawning.
  • The mob's collision box must not intersect with a block.
  • For all mob types excluding passives and fish, spawns fail unless within a 128 radius block sphere around the player. For fish, spawns fail unless within a 64 block radius of the player. [1]
  • Gamerule DoMobSpawning is true
  • For non-aquatic mobs, the spawning block and the block above that cannot be rails, powered rails, detector rails, activator rails, redstone components, wither roses (except for wither skeletons) or sweet berry bushes (except for foxes).

Hostile Mobs:

  • The difficulty must not be Peaceful, excluding piglins and hoglins
  • This also affects ocelots[2]
  • For all hostiles other than guardians, drowned, and phantoms:
    • the block directly below it must have a solid, opaque, top surface (this includes upside down slabs, upside down stairs, and others) or be soul sand or a slime block.
    • the block directly below it must not be bedrock, barrier, or‌ any type of trapdoor‌ or glass.
    • The mob's collision box must not collide with any liquid.
    • The block above the spawning block must be transparent
  • For slimes from swamp biomes, creepers, skeletons, wither skeletons, witches, zombie villagers, husks, strays, drowned and spiders:
    • The light level divided by 8 is the chance of a spawn failing; thus mobs spawn at light level 7 and below.
    • Spawns with sky access in overworld have an additional 50% failure rate
    • If it is a slime from a swamp biome, then.....
      • the spawning block must be in a swamp biome
      • the spawning block be on level 51 through 69 inclusive
      • chance of failure based on the phase of the moon
      • with a 50% chance of failure.
    • If it is a husk or stray, then....
      • The location of the spawn must have sky access (i.e. have a skylight level of 15).
    • If it is a skeleton in a Nether fortress, then...
    • The light checks in the general hostile mob check don't apply to:
      • Slimes from slime chunks (see the slime page for details), which spawn when:
        • the spawning block is below level 40.
        • with a 90% chance of failure.
      • Ghasts, which spawn:
        • With a 95% chance of spawn failure.
      • Magma cubes
        • The block the mob spawns on cannot be nether wart.
      • If it is a hoglin, then...
        • the block below must not be a nether wart block
      • If it is a blaze, then...
        • the light level must be 11 or darker.
      • If it is a piglin or zombified piglin, then...
        • the light level must be 11 or darker.
        • the block below must not be a nether wart block
      • If it is a polar bear, then.....
        • The light level must be greater than 8.
        • The block beneath must be ice.
        • The spawning block must be in a frozen ocean or deep frozen ocean.
      • If it is a blaze, wither skeleton, skeleton, magma cube or zombie pigman in the fortress external bounding box:
        • the block beneath must be nether bricks.
      • If it is an ocelot, then.....
        • the spawning block must be level 62 or higher.
        • the block directly below the spawning block must be grass or leaves.
        • there is a 13 chance for the spawn to fail in jungles, 100% chance in bamboo jungles and jungle edges.
  • For Guardians and Drowned:
    • The spawning block, the block above and the block below must be water, including waterlogged blocks and bubble columns.
      • If it is a guardian, then...
        • 95% chance of failure if the spawning block has sky exposure (details).
      • If it is a drowned:
        • It has a 140 chance to succeed in oceans, while a 115 chance to succeed in rivers.
        • In ocean biomes, drowned spawn at a height less than 5 blocks below sea level.

Passive Mobs

  • The mob's collision box must not collide with any liquid.
    • if it is not a strider, the light level of the spawning block must be 9 or brighter.
      • If it is a mooshroom, then.....
        • the block directly below the spawning block must be mycelium.
      • If it is a turtle then.....
        • the block directly below the spawning block must be sand.
        • the spawning block must be level 67 or lower.
      • If it is a Ocelot, then....
        • Spawn has a 33% chance of failure.
        • the block directly below the spawning block can either be Grass Block or Leaves
      • If it is a Parrot, then....
      • If it is a Rabbit, then....
      • For all others then.....
        • the block directly below the spawning block must be a grass block.
    • If it is a strider, then.....
      • Spawn attempts with lava above check upward as long as there is still lava for if they can successfully spawn in a lava block with air on top.
      • Striders spawn at y level 31 or lower.

Aquatic mobs (squid, cod, salmon, pufferfish, tropical fish or dolphin:

  • the spawning block and the block above must be liquid (water) but it cannot be waterlogged
  • the block below the spawning block must be water or waterlogged
    • If it is cod, salmon, pufferfish, tropical fish, then the water ambient mobcap must not be full
    • If it is squid or dolphin, the water creature mobcap must not be full
    • *If it is a squid, then...
        • the spawning block must be between level 46 and 62, inclusive
        • the spawning block must be in an Ocean or River
      • If it is a dolphin then.....
        • the height of the spawn must be greater than 45 and less than sea level (62).
        • the spawning block must be in an ocean or deep ocean

Ambient mobs:

  • The mob's collision box must not collide with any liquid.
    • If it is a bat, then...
      • the spawning block must be at level 62 or below.
      • If the real-time day is between October 20 and November 3, then the light level must be 7 or darker. Otherwise, the light level must be 4 or darker.

If all of these conditions are met then the mob is spawned.

Spawn Costs:

Locations that do not have spawning potential reliant spawns are marked by wart blocks or netherrack

enderman within warped forests, and skeletons, ghasts, striders and enderman in soul sand valleys increase a charge within the spawn cost. If the charge is high enough in an area, any mob that adds to the charge does not spawn.

Charge raising mobs add the charge in a sphere around them. This occurs farther the charge cancels spawns. Mobs' charge spheres don't cover each others' up, but stack, affecting areas further away, given the mobs are in proximity. The charge set by 1 mob is the same throughout the block the mobs spawns in and the block south, east, and southeast adjacent to it. From that, charge prevents spawns within 6 blocks straight between them or 4 blocks along a diagonal, given no other charge affecting mobs are present.

Due to how Minecraft spawns mobs, this leads to a lot of mobs spawning in any space outside of these biomes.

Notes:[edit]

  • Buildings surrounded by air spawn more mobs inside than underground rooms because packs that spawn outside of the building can spawn mobs inside it.
  • The mob caps tend to be reached in seconds. Because of this, mobs can be funneled into a spawning room by preventing them from spawning outside of it.
  • The caps also mean that the faster mobs are killed, the faster new mobs appear.
  • If the player's view distance or the server view distance in multiplayer is at 9 or below, mob spawning is severely reduced (or they despawn too quickly), and may result in the player encountering no mobs at all. Set the view distance to 10 or higher to ensure mobs spawn correctly.
  • The player can block certain mobs from spawning using block collisions, to get desirable drops from a mob farm. Examples of this include a feet height collision adjacently and a top half trapdoor to allow only creepers to spawn, and a transparent block with collision in the block above the spawning block to allow only spiders.

Bedrock Edition[edit]

Natural spawning in Bedrock Edition shares some similarities to natural spawning in Java Edition. In Bedrock Edition, there are two main types of natural spawns: pack spawns and structure mob spawns. Structure mob spawns are mobs spawned as part of a structure, such as nether fortresses, witch huts, etc. Pack spawns account for all other types of natural spawns, including mobs that spawn individually (i.e. not in a pack of 2 or more). Both types of natural spawns follow the same rules for spawn conditions and the mob cap, however, most animals can spawn at light level 7 or higher rather than 9 or higher.

Mob spawning in bedrock edition happens 24-44 blocks away from the player, and only simulated chunks can spawn mobs. There is a 112000 chance of the mob spawning algorithm attempting to run per chunk, per tick.

Bedrock Edition mob cap[edit]

There are two main mob caps that affect spawning: a global mob cap and population control caps for general mob types. The global mob cap for natural spawns is set at 200 regardless of difficulty. The global mob cap affects only natural mob spawning, and does not affect mobs spawned through breeding, spawn eggs, the /summon command, spawners or any other type of mob spawning. Only mobs that have spawn rules count toward the global cap (i.e. armor stands and minecarts do not take up cap space). In addition, only mobs that are within ticking areas (both those around players and those set manually using the /tickingarea command) count toward the global mob cap; mobs not ticked do not count toward the global mob cap. Specific mobs types can also have their own density caps listed below:

Mob Density Caps
Mob Surface Cap Cave Cap
Cod 20 0
Creeper 5 Unlimited
Dolphin 5 0
Drowned 5 in ocean
2 in river
0
Ghast 0 2
Phantom 5 0
Pufferfish 3 0
Salmon 10 in ocean

4 in river

0
Squid 4 in ocean

2 in river

0
Tropical Fish 20 for preset pattern
20 for random pattern
0

Alongside the global mob cap are population control caps. The population control caps limit how many mobs of each type and category can spawn within a 9 chunk by 9 chunk square region surrounding the chunk in which the spawn attempt is made. Mobs in chunks outside a ticking area still count toward population control counts as long as they were previously loaded (i.e. within simulation distance at some time) after relogging. The population control caps are split up into two distinct categories: a cap for surface mobs, and a cap for cave mobs. Cave mobs do not count toward the surface mob cap, and surface mobs do not count toward the cave mob cap. Whether a mob counts as a surface mob or a cave mob is determined by where it spawned, not where it happens to be at the moment.

There are five categories of mobs: ambient, animal, monster, pillager, and water_animal. The population control cap for each category and location of mob in each dimension is as follows (* denotes values that are coded in the game but not actually used by any mobs):

Population Control Caps
Category Location Overworld Nether The End
Ambient Surface 0 0 0
Cave 2 0 2*
Animal Surface 4 0 4*
Cave 0 4 0
Monster Surface 8 0 10
Cave 8 16 8
Pillager Surface 8 0 8*
Cave 8 0 8*
Water_Animal Surface 36 0 36*
Cave 0 0 0

Bedrock spawn conditions[edit]

The following rules apply to most mobs:

  • Mobs spawn between 24 and 44 blocks spherical radius from the player.
  • The bottom part of the mob (i.e. the feet of a standing mob, or the whole body of a mob <= 1 block tall) can spawn only in an air block, or for water mobs in a water block. A few naturally-generated, non-motion-blocking blocks such as grass and flowers are ignored for this rule.
  • There must be a block with a full, solid top surface under the spawn location for the mob to spawn on. (I.e. mobs cannot spawn on carpets, lower slabs, fences, right-side-up stairs, redstone repeaters, chests, etc.)
  • Mobs cannot spawn on transparent full blocks like glass and leaves.
  • For mobs that can spawn floating in water or flying in air, the block that is checked for spawning is the water or air block immediately above the first solid top surface block below the spot where the mob would spawn. (So for example, phantoms cannot spawn over a field covered in carpet, and fish cannot spawn in an ocean where bottom slabs cover the ocean floor.)
  • Most overworld monster cannot spawn if the light level is greater than 7.
  • Most overworld animals cannot spawn if the light level is less than 7.

Pack spawning[edit]

Pack spawning happens in two stages: first attempt to spawn surface mobs, then attempt to spawn cave mobs. Before spawning, the population control cap is calculated based on the 9x9 square area surrounding the current chunk.[more information needed] Spawning begins by picking a random X and Z location within the chunk currently being evaluated. The Y coordinate is determined by starting at the world height and searching downward for the next block solid-top-surface block with a non-solid block above it. The first such block that is found is considered to be the surface, and the algorithm attempts to spawn a surface mob pack. The algorithm then continues to search downward for the next suitable block with a non-solid block above it. When a block meeting the criteria is found, the algorithm attempts to spawn a cave mob pack at that block location. Cave spawn attempts continue until the Y coordinate reaches the world bottom, and do not stop even if a cave pack was spawned.

Surface and cave pack spawn attempts then go through the following steps to figure out what mob to spawn and how many:

  1. Picks a random mob.
    • If the current spawn location is in a liquid, pick a random water mob.
    • If the light level is 7 or higher, there are no other blocks above the current location, and the current location is a grass block, pick a random animal mob.
    • Otherwise, spawn a monster mob.
  2. Picks a random number of mobs to spawn in the pack. Each mob can have its own min and max pack size, and the pack size can depend on difficulty and biome.
  3. Make sure the spawn location has suitable spawn conditions.
  4. Limit the number of mobs spawning based on the global mob cap. No mobs spawn if the mob count already meets or exceeds the mob cap.
  5. For each mob to spawn, check that spawning it would not exceed the population control cap or mob density cap.
    • If spawning the mob would not exceed the population control or mob density caps, then the probability of a mob spawning can be calculated using the formula: (mob density cap - current mob density count) / mob density cap
  6. Finally, attempt to spawn the mob in the world.
    • Spawning the mob can fail; for example, if spawning it would cause it to spawn inside of a block or part of a wall.

Other types of spawning[edit]

Despawning[edit]

Java Edition[edit]

Various mob spawning ranges, illustrated.

All hostile mobs excluding villagers that were converted to zombie villagers or witches, chicken jockeys, Shulkers, Withers, and Ender dragons despawn unless they have been marked persistent. Non-hostile mobs that despawn include hostile wolves and ocelots. Non-passive mobs such as dolphins, fish, and bats despawn unless marked persistent.

  • A mob that has had no player within 32 blocks of it for more than 30 seconds has a 1800 chance of despawning on each game tick (120 of a second), which is a 2.47% chance per second. Therefore, the average lifetime of monsters not within 32 blocks of a player is 40 seconds (after the initial 30 seconds have elapsed).
  • Mobs other than fish despawn immediately if no player is within 128 blocks of it.‌[Java Edition only], while fish despawn if no player is within 64 blocks[1]
    • Note that this is a Euclidean sphere, not a cylinder from map top to bottom and not a taxicab sphere (an octahedron). Example: A mob at 0/y/0 remains at least 30 seconds (as above) if the player moves to 65/y/65 (real distance 91.9), but despawns immediately if the player moves to 91/y/91 (real distance 128.7).
    • The chunk the mob is in must still be loaded to the mob to despawn. Otherwise, the mob is saved until the chunk is loaded again.
  • Most hostile mobs (including those that are holding items) in a world despawn if the difficulty is set to Peaceful, regardless as to where the player is positioned in the world. This excludes certain
  • Despawning does not occur while there are no players in the dimension.
  • Chickens that originally spawned as chicken jockeys follow zombie despawn rules, rather than chicken despawn rules.

Mobs are persistent, meaning they do not despawn and do not count toward the mob cap, when:

  • They are a passenger to another mob
  • They spawned as part of a structure
  • They have had something added to their inventory, including having something dispensed upon them (such as a saddle) or something they have picked up, but never for anything they spawn with. This includes dolphins playing with items.
  • They have been named with a name tag . However, one created from a renamed spawn egg does despawn as normal.
  • For enderman, if they have picked up a block
  • For fish, if they have been placed out of a fish bucket
  • Hoglins, if they have been right clicked with a crimson fungus
  • They have had the NBT tag {Perisistence:1b} set on them, whether by being summoned with it, or set by /data modify
  • Mobs such as Iron Golems and Snow Golems do not despawn.

Bedrock Edition[edit]

Persistence[edit]

In Bedrock Edition, on simulation distance of 4 chunks mobs despawn instantly if 44 blocks away from the player.

  • Almost all naturally spawning mobs now despawn when they're 44 blocks or further away from the nearest players in a world with simulation distance 4. On higher simulation distances, mobs are despawned when they're in a chunk at the edge of the simulation distance up to a distance of 128 blocks from the nearest player.
  • All fish despawn at a max range of 40 or more blocks on all simulation distances.
  • If mobs are between 32 and 44 blocks from the nearest player, they must not take damage for 30 seconds as well as succeeding a 1 in 800 chance to despawn.

The following entities always have persistence:

History[edit]

This section is missing information about Bedrock Edition.
Please expand the section to include this information. Further details may exist on the talk page.
Java Edition Classic
August 25, 2009Mobs shown to spawn in groups.
?The spawning area used to be 17x17 chunks rather than 15x15. The area was reduced, but the old size is still used to calculate mob caps.
It was not always possible to funnel mobs into a spawning room by preventing them from spawning elsewhere. Some older sources of information about spawning might make reference to this.
Large amounts of empty space used to encourage spawning in the general area. This remains true on a smaller scale, and only horizontally, due to pack spawning.
Java Edition Alpha
v1.2.0?The chunk 0,0 (X 0-16 and Z 0-16) is no longer always the first chunk evaluated for mob spawning. If one built a dark room inside that chunk, all mobs would spawn inside that room and nowhere else.
Java Edition Beta
1.8Pre-releaseThe player's spawn point is now bound to a specific biome rather than to any sand block (when this was first the case is unknown). The player can spawn in forest, swamp and taiga biomes.
Java Edition
1.0.0?Previously, spawn was determined by light level rather than the current chunk properties. This was no longer the case in 1.0.0. In a Beta world, hostile mobs would spawn in light level 7 or lower while friendly mobs would spawn in light levels 9 or higher. Because of this, hostile mobs had a slight chance of spawning even though it was light due to them spawning in the air where there was little light. If you had a lot of torches down, go down to your mine, then return, you would have a tendency to find your house having some cows, pigs, chickens or sheep running about.
1.112w01aThe biomes valid for the player's spawn location were adjusted. Players can now spawn in forest, plains, taiga, forest hills and taiga hills biomes.
1.2.112w03aThe player's spawn point can now also be located in jungle and jungle hills biomes.
1.814w25aMost restrictions on the pack location are removed. Formerly it had to be an air block, now any non-opaque block suffices.
1.915w46aWhen spawning mobs, the spawning block cannot block movement (formerly just had to be non-opaque) and cannot be any type of rail. Also the block above can no longer be liquid.
15w51aAdded spawnRadius gamerule to control the size of the world spawn area.
pre2Pack spawning mechanics adjusted, "12 attempts" is now "up to 12 attempts" and is even more heavily weighted toward the center.
1.1519w37aWhen breedable mobs spawn naturally in a group, the group now sometimes includes babies. (Has a 5% or 10% chance depending on the animal.)

Issues[edit]

Issues relating to "Spawn" are maintained on the bug tracker. Report issues there.

Trivia[edit]

  • The world spawn (the point where players spawn if they have no valid bed spawn) is usually a random (seed determined) point between -500 and +500 on the X and Z axis. If the chosen point is in water (due to nothing but ocean biomes in the -500 to +500 range), a second attempt is made between -1500 to +1500. If this fails due to ocean, the game gives up and puts the world spawn in the middle of the ocean (still at the surface) (attempting to play the flat lands preset Water World does this, for example). Normally, a player who spawns in the water does so near the shore because the world spawn itself picked a spot there.
  • An opaque block normally causes all blocks below it to spawn cave mobs, but not if a transparent block is placed on top. This can be exploited for certain mob farms.

References[edit]

External links[edit]