Minecraft Java Edition, Commands – How to Create Husk and Stray Spawners

minecraft-commandsminecraft-java-edition

I have tried to make them by using this for example:

/setblock ~0 ~1 ~0 mob_spawner 0 replace {SpawnData:{id:{ZombieType:6},SpawnCount:1,SpawnRange:4,maxNearbyEntities:6,Delay:20,MinSpawnDelay:60,MaxSpawnDelay:120}

But it just makes a pig spawner. I know ZombieType:6 spawns a husk, but what is wrong with this command? The same goes for strays SkeletonType:2b is the tag but the command won't work.

Best Answer

Currently, you have set the id to {ZombieType:6}. A husk's id is still just Zombie, ZombieType is a separate tag that it has.

Try the following instead:

/setblock ~ ~1 ~ mob_spawner 0 replace {SpawnData:{id:Zombie,ZombieType:6},SpawnCount:1,SpawnRange:4,maxNearbyEntities:6,Delay:20,MinSpawnDelay:60,MaxSpawnDelay:120}