/spreadplayers
Distributes entities randomly across an area. Useful for minigames, random spawn placement, and similar applications.
Syntax
/spreadplayers <center> <spreadDistance> <maxRange> [under <maxHeight>] <respectTeams> <targets>Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| center | vec2 | Required | The center point (x z) of the spread area. |
| spreadDistance | float | Required | The minimum distance between spread entities. |
| maxRange | float | Required | The maximum distance from the center that entities can be spread to. |
| maxHeight | integer | Optional | Maximum Y height for placement (used with 'under' keyword). |
| respectTeams | boolean | Required | If true, players on the same team are placed together. |
| targets | entity | Required | The entities to spread. |
Examples
/spreadplayers 0 0 10 100 false @aSpreads all players randomly within 100 blocks of 0,0 with at least 10 blocks between each player.
/spreadplayers 0 0 5 50 true @aSpreads all players within 50 blocks of center, keeping teammates together.
/spreadplayers ~ ~ 3 20 under 100 false @aSpreads players around your position, ensuring placement below Y=100.
Common Mistakes
- Setting spreadDistance larger than maxRange, makes it impossible to place all entities and the command fails.
- Not accounting for terrain, entities are placed on the highest block, which may be in undesirable locations.
Notes
Entities are placed on the highest solid block at each position. The 'under' parameter (added in 1.16) restricts placement to below a certain height, useful for cave games.
Related Commands
Need a Minecraft server?
Try these commands on Astroworld or host your own server.
Try Astroworld Hosting