Monster Spawner



Monster Spawners are blocks with a transparent dark grey lattice structure found in dungeons as a guardian to the treasure found within. Inside the block there are flames that do not give off any light, and a miniature spinning version of the mob that is spawned, which slowly increases speed until the next mob is spawned. Spawners found in an Abandoned Mine Shaft surrounded by cobwebs always spawn cave spiders.

There are many contraptions designed to kill mobs from spawners, usually trap with a long fall, drowning, lava, cactus or a combination, allowing the player to collect spoils in great numbers with little risk (see dungeon mob farming.)

Spawning Behavior
A spawner will create mobs provided there is space for its mob type to be generated and the light level within the spawning radius remains below seven. Mobs are created within an 8 x 8 x 3 high area centered on the spawner block's lower left corner. Note that mobs can spawn in any dark space within range, even if the spawner is fully lit The spawner will only spawn mobs if the player is within 16 blocks of it.

Note: Pig spawners require grass covered dirt near the spawner in order for the pigs to spawn.

Note: Placing torches around a monster spawner used to deactivate it so that it could not spawn monsters prior to 1.6, but that has been changed and no longer works, but (in 1.8) placing a single torch on top of the spawner will shut it off. If there is no valid place dark enough for monsters to spawn, however, no monsters will be spawned.

The monster spawner will wait 200 + x ticks between spawns where x is a random number selected between 0 and 599 on each spawn, and a tick is 1/20 of a second. This means that on average, it will attempt to spawn a mob every 24.975 seconds. If 6 or more monsters of its type are present within a 17 x 17 x 9 area centered on the spawner block, the spawner "poofs" without creating a monster and then waits for the next interval. Otherwise, it tries 4 times to place the mob at a random position within a 8 x 8 x 3 high area centered on the spawner block's lower left corner. If the 4 places that it tries are all invalid, it waits for the next spawning to try again.

Unedited Monster Spawners will spawn Spiders, Skeletons, Zombies, Blazes, Silverfish or Cave Spiders. Cave Spider spawners appear only in Abandoned Mine Shafts, Silverfish spawners only in the portal room in Strongholds, and Blaze spawners only appear 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 aforementioned trap without any trouble. The brief instant that the monster exists in the world before being removed is enough time for the player to be pushed around.

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

 * 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.
 * Before the 1.8 update, if the fog key was rapidly pressed, everything in the map briefly becomes invisible for a fraction of a second except particles (such as the fire particle inside a monster spawner). This could make finding dungeons easy. This relied on client-side lag, so a faster computer would not be subject to this exploit.
 * 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 was lighter. Monster Spawner-Pre Beta 1.9.png
 * It is possible to obtain a monster spawner using an enchanted tool with 'Silk touch' in 1.9 pre release 3. However, the placed spawner will still only spawn pigs. This can be used to the players advantage to create an unlimited food source, which also means the player will not have to breed pigs using wheat.

Spawning
 * When killed, a zombie will drop 0, 1, or 2 rotten flesh, for an average of 1 rotten flesh/zombie. This means that the ideal production rate of a zombie spawner trap is (60 seconds/minute) / (24.975 seconds/zombie) * (1 rotten flesh/zombie) = 800/333 rotten flesh/minute ~= 2.40 rotten flesh/minute. Analogously, ideal spider traps will produce 2.40 strings/minute, and ideal skeleton traps will produce both 2.40 bones/minute and 2.40 arrows/minute. At this rate, the expected time for a stack of 64 items is 26 minutes and 38 seconds.
 * 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.
 * If the player removes the ceiling of the dungeon and exposes the Monster Spawner and surrounding area to direct sunlight, it prevents monster spawns during the day.
 * A convenient strategy for designing spawner traps is to make the ceiling of the room out of glass and build a dark room on top which can be filled with torches to disable the spawner if the trap needs to be modified or repaired.
 * Rarely, a monster spawner may spawn two monsters (maximum to four) at once.
 * When monsters spawn on peaceful there is an uncommon glitch that allows the mob to play its sound file before it despawns.

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. If the miniature mob slowly builds up speed, it will take longer to spawn a mob. If the miniature mob builds up speed very quickly, mobs will spawn very quickly.

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, however the spawner will become a Pig spawner once it is placed.
 * If a spawner is hacked to create Ghasts, Giants, Squid, Slimes, Endermen or Enderdragons (Giants and Enderdragons don't spawn naturally), 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.