Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
e7f7230267
Commit
e0257a525d
@ -211,7 +211,23 @@ public class TNTSimulator {
|
|||||||
|
|
||||||
private void spawnRandomList(List<TNTSpawn> tntSpawns) {
|
private void spawnRandomList(List<TNTSpawn> tntSpawns) {
|
||||||
if (tntSpawns.isEmpty()) return;
|
if (tntSpawns.isEmpty()) return;
|
||||||
Collections.shuffle(tntSpawns);
|
|
||||||
|
List<TNTSpawn> toShuffle = new ArrayList<>();
|
||||||
|
List<Integer> indices = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < tntSpawns.size(); i++) {
|
||||||
|
TNTSpawn tntSpawn = tntSpawns.get(i);
|
||||||
|
if (tntSpawn.xVelocity || tntSpawn.yVelocity || tntSpawn.zVelocity) {
|
||||||
|
toShuffle.add(tntSpawn);
|
||||||
|
indices.add(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Collections.shuffle(indices);
|
||||||
|
|
||||||
|
for (TNTSpawn tntSpawn : toShuffle) {
|
||||||
|
tntSpawns.set(indices.remove(0), tntSpawn);
|
||||||
|
}
|
||||||
|
|
||||||
for (TNTSpawn tntSpawn : tntSpawns) {
|
for (TNTSpawn tntSpawn : tntSpawns) {
|
||||||
tntSpawn.spawn();
|
tntSpawn.spawn();
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren