Minecraft Wiki

除另有声明,转载时均必须注明出处若簡繁轉換出錯,請以遊戲內為準请勇于扩充与修正内容有兴趣逛逛我们的微博沟通交流,欢迎到社区专页需要协助,请在告示板留言

了解更多

Minecraft Wiki
Advertisement

Template:TranslationNeeded 这篇文章是关于玩家和生物的生成。刷怪箱的更多资讯请参见:刷怪箱.

生成是指玩家和生物被创造和在世界里出生。玩家将会在死亡时在他们的出生点出生,或者在上次睡过的床旁出生。

玩家的生成

单人模式

每个世界都有一个“出生点”,a pair of x,z coordinates within a few hundred blocks of the origin(坐标0,0)。默认的情况下,玩家将会出生在超过海平面,而且适合的位置上。如果没有什么位置(例子,选到的位置被一堆方块占领了), the x and z coordinates will be perturbed by small amounts until a position is found.

睡一张会改变玩家的位置到床的位置。如果那张床在玩家重新出生时不见了或者被阻挡,出生点会改回到之前的出生点。

多人模式

For a precise explanation of player spawning in multiplayer, see: Spawn/Multiplayer Details.

In multiplayer, players will spawn, by default, anywhere within a 20x20 area centered at the spawn point. An individual player can change their spawn point by merely lying in a bed—they do not have to go to sleep (which can only happen if all players sleep at the same time).

A 33x33 block area centered at the default spawn point, and spanning the full height of the map, is "protected". Players, other than server operators, cannot place or destroy blocks in the protected area, nor can they use doors or Redstone devices other than Pressure Plates. Creepers can still destroy terrain in the protected area and TNT placed outside of the protected area will destroy surrounding blocks as usual. Along with this, portals from the nether can connect to the protected area, water/lava/fire can spread from outside into the protected area, and pistons can push items inside as well. Players can place blocks on the edge of the protected area if placed against the side of a block on the outside of the area. However, if the edges of the protected area are avoided, small, indestructible structures can be built. Paintings that are put up can be removed by players in the safe zone, and sign text can be erased by destroying the sign.

动物的生成

Approximately one in ten newly generated chunks will contain animals, usually in packs of up to four of the same species. They will always spawn on the highest available block in a column i.e. the one that can see the sky. For an animal to spawn on it, this block must be opaque and the two blocks above it must be non-opaque. The block does not need to be Grass nor does it need to be illuminated (as it does with Mob Spawning).[1]

Animals do not spawn in desert or ocean biomes, with the exception of squid.

CowInATree

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

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

Very rarely, new animals can spawn in already generated chunks, just like monsters do. Unlike monsters, animals do not spontaneously despawn. As of 1.1, aggressive wolves will despawn like monsters. [2]

生物的生成

Mobs are broadly divided into three categories: hostile, friendly, and water (i.e. Squid). Hostile mobs have a spawning cycle once every game tick (1/20th of a second). Friendly and water mobs have only one spawning cycle every 400 ticks. Because of this, hostile mobs can spawn at any time, but animals spawn very rarely. Instead, most animals spawn within chunks when they are generated (see Animal Spawning).

Mobs spawn naturally within a 15x15 chunk (240x240 block) area around the player. When there are multiple players, mobs can spawn within this distance of any of them. However, mobs that spawn further than 128 blocks from any player will immediately despawn (see Despawning), so the mob spawning area is effectively limited to spheres with a radius of 128 blocks, centered at each player.

Mob caps are roughly proportional to the total number of chunks eligible for spawning. To calculate the precise cap, the spawning area is expanded by one chunk in every direction, so that it is 17x17 chunks in size, and then the total number of chunks is plugged into the following formula:

 cap = constant * chunks / 256

Each mob category has a separate cap and a different constant in the formula:

 Hostile = 70
 Passive = 15
 Water = 5

In single player mode, the chunk count is 17x17 = 289, and the caps work out to:

 Hostile = 79
 Passive = 16
 Water = 5

In multiplayer, chunks that are in range of multiple players are only counted once. So the more spread out the players are, the more chunks will be covered and the higher the caps will be.

The cap is checked once at the beginning of each spawning cycle. If the number of living mobs in a category is over its cap, the entire spawning cycle for that category is skipped.

Spawning science

Example of a mob pack spawning. The 41x1x41 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's not opaque. The red cube is the center of the pack, which must be an air block, but the blocks above and below it can be anything.

Spawning requirements

Requirements for the spawning location of individual mobs

For each spawning cycle, one attempt is made to spawn a pack of mobs in each eligible chunk. A random location in the chunk is chosen to be the center point of the pack. For the pack to spawn at all, the center block must be water for water mobs and air for all other mobs. Note that in the latter case, it must literally be an air block. Any other block, even a non-colliding one, will prevent the entire pack from spawning.

If the pack location is suitable, 12 attempts are made to spawn up to 4 mobs (8 for Wolves, 1 for Ghasts) within a 41x1x41 area centered at that block (that's a 41x41 square that is one block high). Mobs will spawn with the lowest part of their body inside this area. For each spawn attempt, a block location within the pack area is chosen at random. Though the pack area extends 21 blocks out from the center, the random location is heavily skewed toward the center of the pack. Approximately 85% of spawns will be within 5 blocks of the pack center, and 99% within 10 blocks of the center.

All mobs within a pack are the same species. The species for the entire pack is chosen randomly from those eligible to spawn at the location of the first spawn attempt in the pack:

  • In the Overworld, this depends on the biome:
    • Most biomes can spawn Sheep, Pigs, Chickens, Cows, Spiders, Zombies, Skeletons, Creepers, Endermen, Slimes (in certain chunks), and Squid.
    • Forest and taiga biomes can also spawn Wolves.
    • Jungle biome can also spawn Ocelots.
    • Ocean, river, desert, and beach biomes cannot spawn animals, only hostile mobs and Squid.
    • Mushroom biomes can spawn only Mooshrooms.
  • The Nether can spawn only Ghasts, Zombie Pigmen, and Magma Cubes.
  • Blazes spawn only in Nether Fortresses or from Monster Spawners.
  • The End can spawn only Endermen.
  • Cave Spiders spawn only from Monster Spawners, not naturally.
  • Silverfish will only spawn from the stronghold's stone, cobblestone and brick blocks and spawners.
  • The Enderdragon spawns naturally in The End, but not as part of the general mob spawning process.

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

  • There must be no players and no player spawn points within a 24 block distance (spherical) of the spawning block
  • 如果是章鱼。。。
    • 生成的方块上必须含有液体(或者岩浆)
    • the spawning block must be between level 45 and 62, inclusive
    • the spawning mob must not be obstructed by other mobs
  • If it's not a Squid, then...
    • the spawning block itself must be non-opaque and non-liquid
    • the block directly below it must be opaque
    • the block directly above it must be non-opaque
    • the spawning mob must not be obstructed by blocks, other mobs, or water
  • 如果是动物。。。
    • 生成的方块的下面必须是草块
    • 生成的方块的周围亮度必须是9或者更高。
  • 如果是豹猫。。。
    • 生成的方块必须高过62层
    • 生成的方块的下面必须是草块或者树叶
    • 这里有三分之一的机会使生成失败。
  • If it's a hostile mob in the overworld, then...
    • the light level of the spawning block must be 8 or darker, and more light increases the chance that the spawn will fail
    • sunlight falling on the spawning block further increases the chance that the spawn will fail, by up to 50%
  • 如果是史莱姆。。。
    • the spawning block must be in a chunk eligible to spawn slimes (see the Slime page for details)
    • the spawning block must be below level 40
    • for medium and large slimes, the difficulty must not be set to peaceful
    • there is an additional 90% chance the spawn will fail, thus slimes only spawn 1/10th as often as other mobs, all other things being equal
  • 如果是恶魂,会有95%的机会生成失败, thus ghasts only spawn 1/20th as often as other mobs

If all of these conditions are met then the mob is spawned. The pack is complete when 4 mobs have spawned (or 8 wolves, or 1 ghast), or 12 attempts have been made, whichever comes first.

Notes

  • Due to the general block checks, all mobs besides Squid must spawn on top of an opaque block with at least two blocks of headroom, even spiders, ghasts, etc. However, short mobs can spawn in a one block high space if the block above is transparent, like a glass block or piston.
  • While individual mobs can spawn inside signs, pressure plates, and other non-opaque blocks, packs cannot. They need a completely empty block in the center. Since a pack spawns all at one level, there needs to be some air blocks right above a flat surface to allow mobs to spawn on it, and more air blocks will always allow more spawning.
  • Similarly, buildings surrounded by air will 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 they will spawn.
  • Because the caps are only checked at the beginning of a spawn cycle, they can be dramatically exceeded when a large number of mobs spawn in a single cycle. This happens often with squid, which have a fairly low cap (5 in single player) but can spawn in the hundreds in a single cycle, in an area with lots of water.
  • In multiplayer, mob caps are shared by all players, no matter where they are. If one player can make a lot of mobs spawn near them, say, with a mob farm, players elsewhere in the world will see fewer mobs of the same category. Likewise, if a player can prevent mobs from spawning near them, perhaps by hanging around a large body of water and illuminating nearby caves, they will effectively dump their mobs on everyone else.

Historical Notes

  • 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.
  • Before the Halloween Update, the chunk 0,0 (X 0-16 and Z 0-16) was 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.

Other Types of Spawning

A Monster Spawner causes mobs to spawn constantly in the area around it.

A thrown chicken egg has a 1 in 8 chance of spawning a chicken.

Two Snow Blocks in the overworld placed on top of each other, with a Pumpkin or Jack-O-Lantern, causes a Snow Golem to spawn. Likewise, replacing the Snow Blocks with Iron Blocks (with an extra one on opposite sides of the higher block) will cause an Iron Golem to spawn. Iron Golems can also spawn in villages (though the algorithm that causes this has not yet been determined).

In Creative, the player can use Spawn Eggs to spawn most mobs.

Despawning

Mob spawning ranges

Various mob spawning ranges, illustrated

Monsters and squid (but not animals), including hostile wolves as of 1.1, can spontaneously cease to exist, or "despawn", under certain conditions:

  • A mob will immediately despawn if ever there is no player within 128 blocks of it. Note that this appears to be a sphere, not a cylinder from map top to bottom.
  • A mob that has had no player within 32 blocks of it for more than 30 seconds has a 1 in 800 chance of despawning on each game tick (1/20th of a second). That means that such a mob will survive for just under a minute, on average, from the time they spawned or were last within 32 blocks of a player.
  • All hostile mobs in a world will despawn if the difficulty is set to peaceful, regardless as to where the player is positioned in the world.

In multiplayer, despawning does not occur while there are no players in the game.

References

  1. http://www.minecraftforum.net/topic/639466-918-update-animals-can-respawn-proof-within
  2. From what I can tell the corresponding function in 1.1 (in EntityWolf, from my own MCP-decompilation) is now: protected boolean canDespawn() { return isAngry(); } Which would mean that wolfs are persistant even when not tamed. Only when they have become aggressive can they despawn, which is logical since they are then a hostile mob.

External links

Advertisement