Updated:
1. Give any spawn egg
/give @s minecraft:zombie_spawn_egg
/give @s minecraft:allay_spawn_egg 16
The item ID is the mob name plus _spawn_egg. The last number is the count. Bedrock uses the same IDs.
2. Eggs you cannot get in survival
| Mob | Item ID |
|---|---|
| Ender dragon | ender_dragon_spawn_egg |
| Wither | wither_spawn_egg |
| Iron golem | iron_golem_spawn_egg |
| Snow golem | snow_golem_spawn_egg |
Java added these in 1.19.3. A dragon from an egg may just hover in place outside the End. For a real fight, see the ender dragon command.
3. Named or NoAI eggs (Java)
/give @s minecraft:villager_spawn_egg[entity_data={id:"minecraft:villager",CustomName:"Mayor",NoAI:1b,PersistenceRequired:1b}]
This egg spawns a frozen villager named Mayor. Put the same data you would use with /summon inside entity_data, and always include id.
/give @s minecraft:zombie_spawn_egg[entity_data={id:"minecraft:zombie",IsBaby:1b}]
In 1.21.4 and earlier, write the name as CustomName:'"Mayor"'. In 1.20.4 and earlier, use {EntityTag:{...}} instead of the component.
4. Change a spawner
Right-click a spawner with a spawn egg in creative to change its mob. For the command method, see the spawner command.
Troubleshooting
- Unknown item: check the mob name. The snow golem is snow_golem.
- entity_data error: include
idand use Java 1.20.5 or later. - Nothing spawns: hostile mobs do not spawn on Peaceful.
Check your command
The Command Error Doctor checks common syntax mistakes in your browser.