Monster Spawner



Monster Spawners or Mob Spawners are blocks with a transparent dark grey lattice structure found in dungeons, Abandoned Mine Shafts, Strongholds and Nether fortresses. Inside the block there are flames that do not give off any light and a miniature spinning version of the mob that will spawn, which slowly increases speed until the next mob spawns.

Currently, all spawners found in Abandoned Mine Shafts surrounded by cobwebs will spawn Cave Spiders, and all spawners found in Nether fortresses will spawn Blazes.

There are many traps designed to kill mobs from spawners, employing a long fall, drowning, lava, cactus or a combination of these, which allow the player to collect drops in great numbers with little risk (see dungeon mob farming.)

The Monster Spawner is one of the few missing items in Creative Mode, as it is not in the creative menu.

Spawning Behavior
A spawner block will create mobs in the surrounding area, provided suitable spawning locations for the block's mob type can be found in the area. Spawning conditions vary from mob to mob. For example, Overworld monsters can only spawn in darkness (light level 7 or below), and animals must spawn on top of grass (light level 9 or above). However, spawner blocks can spawn mobs in mid-air, ignoring general rules about spawning on solid ground.

A monster spawner is only active when a player is within a 31 block sphere of it. While the block is active, it will spawn mobs within an 8x3x8 block area (8x8 wide and 3 high), centered on the corner of the spawner block with the lower x and z coordinates. Mobs can spawn anywhere in this range that is suitable, even if the immediate vicinity of the spawner block itself is not suitable.

The block will spawn up to 4 mobs at once and then wait anywhere from 200 to 799 ticks (10 to 40 seconds) before spawning again. As it waits, the mob inside the block will spin faster and faster. If the block fails to spawn any mobs because it did not find any suitable locations, it will search constantly until it does. Only when it manages to spawn at least one mob will it start waiting for the next cycle. If, at the time of spawning, 6 or more monsters of the block's type are present within a 17x9x17 area centered on the spawner block, the spawner "poofs" without creating any monsters and then waits for the next cycle.

Note that, while mobs are spawned at a discrete y coordinate, the x and z coordinates are real-valued i.e. not aligned to blocks. Mobs will spawn with their legs at either the same level as the spawner block, one block above it, or one block below it. But horizontally, a mob can spawn with its center point anywhere within the 8x8 range. Since the mob itself takes up some horizontal space, this must be added to the range of the spawner to get the full dimensions of the area they can potentially occupy.

Unedited Monster Spawners will spawn Spiders (with a 1% chance of spawning Spider Jockeys), Skeletons, Zombies, Blazes, Silverfish or Cave Spiders. Cave Spider spawners appear only in Abandoned Mine Shafts, Silverfish spawners appear only in the portal room in Strongholds, and Blaze spawners appear only in Nether fortresses; the other three kinds appear only in Dungeons, with Zombies chosen at 50% probability and Skeletons or Spiders chosen at 25% probability each. Spawners do not drop resources when destroyed, and a placed spawner will spawn only pigs. The spawner type can be changed through Hacking. Spawners can be given unusual entity IDs like Minecart or Boat to make a decorative block with the named entity spinning inside the cage.

In Peaceful difficulty, Monster Spawner blocks will still appear, but any spawned mobs will disappear the instant they spawn. This makes it easy to make the traps without being troubled by the mobs.

The brief instant that the monster exists in the world before being removed is enough time for the player to be pushed around and, in some cases, for the sound file to play.

Detailed Spawning algorithm
This pseudo-code is derived straight from the decompiled source of Minecraft Beta 1.7.3. every spawn cycle (every randInt(200,799) ticks when a player is in range of the spawner), loop 4 times { if there are 6 or more of the mob type in the 17x9x17 area around the spawner, skip this spawn cycle calculate spawnerX = X coordinate of center of spawner - 0.5 calculate spawnerY = Y coordinate of center of spawner - 0.5 calculate spawnerZ = Z coordinate of center of spawner - 0.5 calculate x coordinate of mob = spawnerX + (randDouble - randDouble) * 4, randDouble being a random number between 0 and 1 calculate y coordinate of mob = spawnerY + a random whole number between -1 and 1 calculate z coordinate of mob = spawnerZ + (randDouble - randDouble) * 4, randDouble being a random number between 0 and 1 if all of the conditions specific to the mob type are met, spawn the mob { chicken, cow, pig, sheep, wolf: block below spawning block is grass spawning block has a light level of 9 or higher

creeper, zombie, skeleton, spider: sunlight level of spawning block is less or equal to a random number from 0 to 31 light level of block is less or equal to a random number from 0 to 7

slime: difficulty is not set to peaceful or slime size is small (if it's not peaceful, the algorithm won't get to this point) spawn block y coordinate is less than 16 the chunk containing the spawn block is a slime chunk (1 in 10 chance) pass a 1 in 10 random test ghast: pass a 1 in 20 random test squid: must not collide with any other entities

all except squid and slimes: must not collide with any other entities must not collide with any blocks must not collide with water or lava } }

Trivia

 * Due to a bug, all Mob Spawners found in SMP have pigs inside them instead of whatever creature they actually spawn.
 * Creeper spawners are not found naturally and can only be obtained through mods and/or hacks. This is probably due to the fact that creepers can destroy the spawner, chests, and the dungeon itself.
 * Monster Spawners can spawn monsters in a nearby cave, even when the monster spawner is fully lit, due to its 8 x 8 x 3 spawn radius.
 * The model inside the monster spawner has an ID number like all other mobs, though it is only visible at certain angles and cannot be seen since Beta 1.8.
 * Since monster spawners are stored as tile entities, they cannot be pushed by pistons.
 * It is possible, although very rare, for a monster spawner to occur near the surface and completely buried in sand, with monsters spawning in small gaps underneath sandstone.
 * Unlike most other transparent blocks, it is possible to place torches on a monster spawner.
 * Before the first Beta 1.9 Pre-release, the texture of the cage was lighter.
 * In the 1.9 pre-releases 3, 4, and 5, It was possible to obtain a monster spawner using a tool enchanted with "Silk touch". However, the spawner, when placed, would still only spawn pigs. This could be used to the players advantage to create an unlimited food source, which would also mean the player would not have to breed pigs using wheat. This was fixed in the Beta 1.9 pre-release 6.
 * If a Monster Spawner is destroyed in SMP by a server process (eg TNT) the box will be deleted, but the flames inside will remain.
 * In rare cases, two Monster Spawners occur directly side-by-side.
 * There are no Enderman Spawners because they can remove blocks in dungeons.
 * There are Ghast and Blaze spawners, but they will not spawn in dungeons because Ghasts are too big for it and they could destroy the spawner and/or the chests and Blazes could set the spawner and/or chests on fire.

Spawning
 * When mining near a monster spawner that has no valid places to spawn, sometimes a monster will spawn immediately after a block is mined. The player should take caution for this reason while collecting Moss Stone from a dungeon but hasn't destroyed the monster spawner.  It's speculated this might happen because the spawner gets a chance to spawn before the lighting calculation for the space the block occupied.
 * A monster spawner may spawn 1, 2, 3 or even 4 mobs at once


 * As of 11w49a, you can use spawner eggs to spawn mobs instead, but they are only available in Creative mode.

The miniature mob inside the spawner
 * If you are not within range, the miniature mob inside the spawner will stop spinning, and the mob spawner will stop emitting fire particles.
 * The miniature mob model displayed inside the monster spawner was enabled again in Beta 1.2 after being missing for several versions.
 * The miniature mob inside the mob spawner will spin faster when it is about to spawn monsters. There are set minimum and maximum speeds for which the miniature mob can rotate.

Hacking spawners
 * There was no way to legitimately get a monster spawner to place, before the silk touch enchantment made it possible in 1.9pre4. A spawner placed this way will become a Pig spawner once it is placed.
 * If a spawner is hacked to create Ghasts, Giants, Squid, Slimes, Endermen or Enderdragons (Giant spawners don't spawn anything), the model inside will be miniaturized, but not enough to fit the cage properly, because the scaling factor used is the same as with other mobs.
 * When hacked into the inventory, given with server commands, or in Infdev, placed spawners will only spawn pigs. These player placed spawners will only create pigs if passive mob spawning conditions are met.
 * Monster spawners can be edited with a map editor or client mod to spawn any mob (Most mobs have certain conditions that must be met to spawn).
 * The squid spawners seem to have stopped working since 1.9 prerelease 5.