Monster Spawner

A spawner, otherwise known as a monster spawner $$, is a cage-like block that can spawn mobs. When configured, it contains a miniature, spinning version of the type of mob it spawns.

Obtaining
Spawners cannot be obtained in Survival, even with Silk Touch.

$$, a monster spawner can be obtained from creative inventory or by using. It is initially empty and inert, but can be configured to spawn a desired mob by a spawn egg on the placed block.

$$, spawners are not found in the creative inventory and are the only block with an item form that cannot be picked with. One can be obtained only by using the command, which gives a pig spawner by default; afterward the mob can be changed by  a spawn egg on the placed block.

A, or  command can also be used to obtain a spawner.

Breaking
If broken with a pickaxe, a spawner drops 15-43 experience. When mined with anything else, it drops nothing.

Natural generation
Spawners can generate naturally in the following places:


 * Dungeons
 * One in the center of the dungeon spawning one of the following mobs with the indicated frequency: zombie (50%), skeleton (25%), or spider (25%).


 * Mineshafts
 * Any number of cave spider spawners, densely surrounded by cobwebs, scattered throughout.


 * Woodland mansions
 * Optionally one spider spawner, densely surrounded by cobwebs, in a rarely generated secret room on the 2nd or 3rd floor. It is sometimes visible through the windows from outside.


 * Strongholds
 * One silverfish spawner in the end portal room.


 * Nether fortresses
 * One or two blaze spawners on fenced platforms with full-block "stairs" leading up to them. Normally two are generated per fortress, but there can be fewer.


 * Bastion remnants
 * Any number of magma cube spawners hanging from chains underneath a bridge in treasure rooms.

Usage
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 activate but do not spawn monsters $$. $$, zombified piglins, magma cubes, and ghasts do not spawn at all and other hostile mobs disappear immediately after spawning.

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.

$$, they have a hitbox slightly smaller than a full block and one can, therefore, walk on the edge of a supporting full block directly below the spawner.

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 up to 4 blocks away from the spawner horizontally, and up to 1 block away vertically, effectively meaning mobs can spawn in a 9×3×9 area around 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 farther 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 9 blocks in the 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. This is often used to disable magma cube spawners, as magma cubes can spawn in any light level. However, since all magma cubes require the space of a large magma cube in order to spawn, a clever placement of as little as 9 solid blocks a layer above the spawner (see right image) can completely disable it.

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" sounds.

Piston interactivity
Spawners cannot be pushed by pistons. They also cannot be pushed nor pulled by sticky pistons.

ID




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




 * See Bedrock Edition level format/Block entity format.
 * See Bedrock Edition level format/Block entity format.

Trivia

 * Any spawner placed in Java Edition defaults as a pig spawner.
 * A player-created spawner containing zombies can never spawn a Zombie Villager.
 * $$, spawners containing zombies have a small chance to spawn a chicken jockey.
 * There are no such thing as iron golem spawners or snow golem spawners.
 * 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 in Java Edition.
 * Spawners in mushroom fields, mushroom field shore, or the Void biome can function normally, despite those biomes having no hostile mobs spawn naturally.
 * Spawners are the only block that can be legitimately obtained as an item, but not obtainable from either Creative mode or pick block.
 * It is possible for a pig spawner to generate naturally. If a newer world is loaded in an older version of minecraft, the spawner can lose its metadata, causing it to enter its default state, which is pig. Alternatively, if a buried treasure chest generates next to a spawner, it duplicates the spawner without duplicating the NBT tag, resulting in a natural pig spawner. The chest also gets invalid block(spawner)data, making it unopenable.
 * If a dungeon spawner overwrites a dungeon chest during world generation, the spawner does not spawn any mobs. It appears as a pig spawner, but placing a hopper underneath it reveals the contents of the chest that should have been there.