Monster Spawner

Spawners are cage-like blocks that spawn mobs. They have a miniature mob spinning inside them that represents the mob that they spawn.

Natural generation
Spawners can generate naturally in these places, spawning mobs chosen randomly when generated:


 * Dungeons
 * Placed in the center of the dungeon. It may be a zombie spawner (50% chance), skeleton spawner (25%), or spider spawner (25%).


 * Mineshafts
 * Cave spider spawner. Heavily surrounded by cobwebs.


 * Woodland mansions
 * Spider spawner. Heavily surrounded by cobwebs in a rarely generated secret room. If this room does generate, it does so on the 2nd or 3rd floor.


 * Strongholds
 * Silverfish spawner. Located in the end portal room. One per stronghold.


 * Nether fortresses
 * Blaze spawner. Located on nether fortress balconies with stairs leading up to them. Normally two per nether fortress, although more can generate.


 * Bastion remnants
 * Magma cube spawner. Located in treasure rooms hanging underneath a bridge. Chains are attached to the top of these spawners.

Obtaining
Spawners cannot be obtained in Survival, even with Silk Touch. They also cannot be moved using pistons.

$$, spawners are not found in the creative inventory and are the only block with an item form that cannot be picked with. They can be obtained only by using the command, which gives a pig spawner by default; the mob can be changed by  a mob spawn egg on the block. The or  command can also be used to create spawners. $$, empty spawners can be found in the creative inventory or can be picked with.

Info
The spawner spawns mobs in a 9×3×9 area (see ) around it when the player is within 16 blocks. Suitable spawning locations for the block's mob type are provided in the area. The spawner attempts to spawn 4 mobs around it, then waits from 10 to 39.95 seconds before spawning more.

When obtained as an item and placed, it spawns pigs by default $$, or appears empty $$.

The spawned mob can be changed by a spawn egg on the spawner.

In Peaceful difficulty, spawners still appear and work, but any spawned hostile mobs disappear immediately after spawning. Zombie pigmen, magma cubes, and ghasts do not spawn at all.

Spawners are transparent in their rendering only - they exhibit behavior of opaque blocks.

Spawners cannot be moved by pistons.

$$, they have a hitbox slightly smaller than a full block and their edges can, therefore, be walked on with a supporting full block below.

Breaking
If broken with a pickaxe, they break quickly and drop some experience.

Mechanics
A spawner activates when a player comes within a spherical radius of 16 blocks from the center point of the block; i.e. 15.5 blocks from the block itself. While the block is active, it spawns mobs within an 8×3×8 block volume (8 wide, 8 long, and 3 high) centered on the center of the block, effectively meaning mobs can spawn in a 9×9 horizontal area, or 3.5 blocks vertically from the spawner. $$, the spawning area is the diamond shape around the spawner, extending 4 blocks in each direction. Mobs can spawn anywhere in this range that is suitable, with mobs more likely to spawn closer to the spawner than further away.

While mobs are spawned at fractional x and z-coordinates (i.e. not aligned to blocks), they are spawned at an integer y-coordinate. Horizontally, a mob can spawn with its center point anywhere within the 8×8 range, but vertically, mobs spawn with their legs at either the same layer as the spawner block, one block above it, or one block below it.

The block attempts to spawn 4 mobs at randomly chosen points within the spawning area, then wait anywhere from 200 to 799 ticks (10 to 39.95 seconds) before spawning again. As it waits, the mob inside the block spins faster and faster. Except for spawning on a solid block, all of the usual requirements for spawning must be met (not in a solid block, correct light level, etc.), so the spawner often produces fewer than 4 mobs. When it does spawn, it emits a "poof", and more flame particles temporarily appear around it. If the block fails to spawn any mobs because it did not pick any suitable locations, it repeats this process every tick until it succeeds. It starts waiting for the next cycle after it spawns at least one mob. If, at the time of spawning, 6 or more mobs of the spawner's type are present within a 9×9×9 area centered on the spawner block (in Java Edition) or a 16×10×16 area centered on the lower northeast corner of the spawner block (in Bedrock Edition), the spawner "poofs" without creating any mobs and then waits for the next cycle.

Spawning requirements
The spawner performs a relaxed version of the check for spawning check: the general solid block requirement is removed, but the volume (hitbox), the light level, and other checks are kept. As a result, for some types of mobs to spawn in the outer planes of the spawning volume, some planes outside the volume may also need to be free of opaque blocks to conform with the mobs' height, width, or other rules governing their individual spawn volumes. For example, for mobs that are two or more blocks tall such as zombies, skeletons, or blazes to spawn in the top y-layer, the layer above that must contain only air.

For all of the volumes listed in the table, the horizontal plane is centered on the center of the spawner block. While the spawning volume for pigs is 8.9×2.9×8.9, the requirement of grass blocks that are necessary for pigs to spawn reduces the actual volume in which they successfully spawn to 8.9×1.0×8.9. Other mobs can spawn in mid-air, ignoring general rules about spawning on solid ground.

The spawn conditions do not include biomes for most mobs. As such, spawners can place mobs where they normally wouldn't generate. For example, a mooshroom spawner can operate in a plains biome as long as there are mycelium blocks within the spawn area because the mooshroom's spawning code only checks for mycelium. The reason mooshrooms are not actually spawned elsewhere is that the game does not normally try to spawn them in other biomes: only the mushroom field biome has mooshroom on the list of things to spawn.

Disabling


The way a spawner can be disabled only depends on the entity it tries to spawn, as the condition is entirely mob dependent.

For a spawner that generates mobs that spawn only in dark conditions (light level ≤ 7), a torch placed on any side or top of the spawner is sufficient to disable it for the whole 9x9x3 volume. <-Needs to be revised, low light condition mob spawners in all cases in which block light levels are less than or equal to 7 in the 9x9x3 area continuously spawn mobs, one torch on the spawner is not nearly enough light to protect the entire room.

For a blaze or silverfish spawner, a light level of 12 is required to prevent spawning. This can be achieved by:
 * Laying 16 blocks in a pattern shown on the right using blocks having a luminance value of 15
 * Laying a dense 7×7 grid of torches on the spawner's Y level
 * For Bedrock Edition, placing one block of luminance 15 on the four sides of the spawner covers the whole spawning diamond.
 * For silverfish, all stone (or variant) blocks on the floor of the spawning zone must be removed too, as they can spawn on stone at any light level.

The sure-fire way of disabling a spawner is to fill the whole spawning area with some solid block.

Custom spawners


Using commands, spawners can be customized:
 * They can be made to spawn any kind of entity.
 * A single spawner can spawn multiple different entities, chosen at random from a list.
 * Properties can be set on the spawned entities.
 * Various range and timing properties of the spawner can be changed.

Detailed technical information about custom spawners can be found below.

ID




Block entity
A monster spawner has a block entity associated with it that holds additional data about the block.

Trivia

 * Spawners containing zombies have a small chance to spawn a chicken jockey.
 * Spawners containing zombies or skeletons have a chance for the mob spinning inside to have armor.
 * Spawners containing spiders have a small chance to spawn a spider jockey.
 * Spawners containing Pillagers have a small chance for the mob spinning inside to be a Raid captain.
 * Spawners in mushroom fields, mushroom field shore or the Void biome can function normally, despite those biomes having no hostile mobs spawn naturally.
 * Although $$ a spawner emits light level 3, the only effect on gameplay is to make an inactive spawner slightly more visible in a dark area because mob spawning and crop growth effects are always the same for light levels 0-3.
 * Spawners are the only block that can be legitimately obtained as an item, but not obtainable from either Creative mode or pick block.