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.

Obtaining
Spawners cannot be obtained in Survival, even with Silk Touch. However, they can be retained from worlds played in versions where they were legitimately obtainable.

Breaking
If broken with a pickaxe they drop experience.

$$, 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.

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.

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 four mobs around it, then waits from 10 to 39.95 seconds before spawning more.

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

Although spawners are transparent in their rendering and do not block light, they behave like opaque blocks with respect to their interaction with other blocks and adjacent effects.

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.

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 northwest 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 ordinary spawning check: the general solid block requirement is removed, but the volume (hitbox of the mob), 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 depends on the entity it tries to spawn.

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.

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
 * $$, placing a light source of level 15 on four surfaces

A spawner is also disabled by filling the spawning volume with solid blocks.

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.

Note Blocks
Spawner can be placed under note blocks to produce "bass drum" sound.

ID




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

Trivia

 * A player-created spawner containing zombies can never spawn a Zombie Villager.
 * 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.
 * Skeletons and Zombies inside spawners can pick up dropped armor.