Fix TNTSimulator 2-axis compression
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-10-01 17:41:55 +02:00
Ursprung e7f7230267
Commit e0257a525d

Datei anzeigen

@ -211,7 +211,23 @@ public class TNTSimulator {
private void spawnRandomList(List<TNTSpawn> tntSpawns) {
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) {
tntSpawn.spawn();
}