The bug
The /spreadplayers
command treats entities on multiple teams as if they were all on the same team.
In the latest versions the command feedback also says that the spread distance is Infinity
:
18w05a
Spread 1 teams around 25.751766, -20.911484 with an average distance of Infinity blocks apart
How to reproduce
Create two teams
/team add team_a /team add team_b
Summon two armor stands which are in the teams
/summon armor_stand ~ ~ ~ {CustomName:"\"A\"",Team:team_a} /summon armor_stand ~ ~ ~ {CustomName:"\"B\"",Team:team_b}
Use
/spreadplayers
for them/spreadplayers ~ ~ 1 5 true @e[type=armor_stand,team=!]
→ ❌ They were both teleported to the same position
Code analysis
Based on 1.11 decompiled using MCP 9.35 rc1
Incorrect team count in start message (does not exist anymore)
The start message commands.spreadplayers.spreading.
("Spreading ... blocks around ...") uses the entity count instead of the team count.
Teams of mobs are not counted
The methods net.minecraft.command.CommandSpreadPlayers.getNumberOfTeams(List<Entity>)
and net.minecraft.command.CommandSpreadPlayers.setPlayerPositions(List<Entity>, World, Position[], boolean)
treat all entities which are not a player as if they were in no team.
Did you make sure the 4th command doesn't put both pigs on the same team?