Use /spreadplayers
/spreadplayers
:
/spreadplayers x z spreadDistance maxRange target
where
x
andz
: the x- and z-coordinates of the centrespreadDistance
: the minimum distance between the entitiesmaxRange
the maximum horizontal distance to spread the entities from the centre specified inx
andz
(must be at leastspreadDistance
+ 1)taget
: the entities to spread
For example, to “summon” zombies at least 1 block apart in a 7 × 7 square centred at your current position, you need to first summon the zombies:
summon zombie
and then teleport them using spreadplayers
:
spreadplayers ~ ~ 1 3 @e[type=zombie,x=~,y=~,z=~,dx=1,dy=1,dz=1]