I am trying to make a minigame where mobs spawn in random places in a set area, how can I do this with command blocks?


1 Answer 1


You can generate Mob Spawner by that commandblock, then you will have random spawning in set area.


  • That area has to be around the spawner (square), so you need to place it in the middle.
  • You can enlarge the area around spawner that is eligible for mob spawning, HOWEVER that is costly resource-wise, so it is better to not make it way too big! (spawner has to scan all blocks in range, that can be CPU-expensive when you make it way too big)
  • You can spawn one mob type per spawner. However you can have advanced commandblock/redstonery to change the spawner.

You can get the command from various command generators, for example this one: https://mcstacker.bimbimma.com/

Here is an example code (for 1.9/1.10) for nearly normal Zombie:

/setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Zombie",CustomName:"Dead Eric",CustomNameVisible:1,HandItems:[{id:wooden_sword,Count:1},{}],ActiveEffects:[{Id:5,Amplifier:0,Duration:1999980}]},SpawnCount:4,SpawnRange:10,RequiredPlayerRange:20,Delay:40,MinSpawnDelay:40,MaxSpawnDelay:80,MaxNearbyEntities:8}

This one will spawn named zombies, you can change everything what you want, number of mobs, range, delay, also you can define coordinates on what the spawner can be placed (default is one block above commandblock) etc.


  • Is there an actually command to spawn them like a spawner does, except only one mob? Commented Sep 15, 2016 at 4:27
  • Could you please expand the command so it is visible and better to understand?
    – user143228
    Commented Sep 15, 2016 at 13:17
  • @EricHandley No, there is no such a command, EXCEPT /spreadplayers, but then you would need two commands (one to spawn, second to spread them), however that have also limitations ( biggest one is that it always targets SURFACE). Commented Sep 18, 2016 at 14:22
  • @RudolfL.Jelínek Expand? I follow the recognized format with commands. See meta.gaming.stackexchange.com/questions/11524/… . It is just random spawner exaple. Commented Sep 18, 2016 at 14:24

Not the answer you're looking for? Browse other questions tagged .