Gamepedia was upgraded to MediaWiki version 1.31 on Wednesday November 14th. To learn more about the upgrade and its effects click here.

Commands/spreadplayers

From Minecraft Wiki
Jump to: navigation, search
spreadplayers
Restrictions

Operator

First introduced

1.6.1 (13w23a)
PE 1.0.5 (PE 1.0.5 build 1)

Teleports entities (players, mobs, items, etc.) to random surface locations within an area.

Syntax
  • Java Edition
spreadplayers <x> <z> <spreadDistance> <maxRange> <respectTeams> <player …>
  • Bedrock Edition
spreadplayers <x: value> <z: value> <spreadDistance: float> <maxRange: float> <victim: target>
Arguments
x z (BE: x: value and z: value)
Specifies the center of the region to spread targets to. x and z must be between -30,000,000 and 30,000,000 (exclusive). May use tilde notation to specify coordinates relative to the command's execution.
spreadDistance (BE: spreadDistance: float)
Specifies the minimum distance between targets. Must be at least 0.0.
maxRange (BE: maxRange: float)
Specifies the maximum distance on each horizontal axis from the center of the area to spread targets (thus, the area is square, not circular). Must be at least 1.0 greater than spreadDistance.
respectTeams[Java Edition only]
Specifies whether to keep teams together. Must be true or false. If true, targets on the same team will be teleported to the same location.
player (BE: victim: target)
Specifies the targets to spread. Must be one or more player names and/or target selectors separated by spaces (@e is permitted to target entities other than players).
Result
Fails if the arguments are not specified correctly, if there are too many targets to satisfy the spreadDistance requirement within the specified area, or if a target is attempted to be spread to outside the world boundary.
On success, teleports targets to random surface locations within the specified area. Targets will always be placed on the top block at a location, and never on lava.
Examples
To teleport all players by team to random surface locations in a 1,000×1,000-block area centered on (0,0), with a minimum distance between teams of 200 blocks:
spreadplayers 0 0 200 500 true @a
To teleport one random player from each of three teams (Red, Blue, and Green), as well as Alice and Bob, to random surface locations in a 200×200-block area centered on (0,0), with a minimum distance between players of 50 blocks:
spreadplayers 0 0 50 100 false @r[team=Red] @r[team=Blue] @r[team=Green] Alice Bob
See also
/tp and /teleport — different commands that teleport a single player or entity to a specific position (even underground).