public List<StructurePiece> getNextPieces() {
final List<StructurePiece> pieces = new ArrayList<StructurePiece>(3);
final boolean twoFloors = hasTwoFloors();
final Random random = getRandom();
if (random.nextBoolean()) {
final StructurePiece bottomFront = getNextPiece();
bottomFront.setPosition(position.add(rotate(0, 0, 5)));
bottomFront.setRotation(rotation);
bottomFront.randomize();
pieces.add(bottomFront);
}
if (random.nextBoolean()) {
final StructurePiece bottomRight = getNextPiece();
bottomRight.setPosition(position.add(rotate(-1, 0, 1)));
bottomRight.setRotation(Quaternionf.fromAngleDegAxis(-90, 0, 1, 0).mul(rotation));
bottomRight.randomize();
pieces.add(bottomRight);
}
if (random.nextBoolean()) {
final StructurePiece bottomLeft = getNextPiece();
bottomLeft.setPosition(position.add(rotate(4, 0, 3)));
bottomLeft.setRotation(Quaternionf.fromAngleDegAxis(90, 0, 1, 0).mul(rotation));
bottomLeft.randomize();
pieces.add(bottomLeft);
}
if (twoFloors && random.nextBoolean()) {
final StructurePiece topFront = getNextPiece();
topFront.setPosition(position.add(rotate(0, 4, 5)));
topFront.setRotation(rotation);
topFront.randomize();
pieces.add(topFront);
}
if (twoFloors && random.nextBoolean()) {
final StructurePiece topRight = getNextPiece();
topRight.setPosition(position.add(rotate(-1, 4, 1)));
topRight.setRotation(Quaternionf.fromAngleDegAxis(-90, 0, 1, 0).mul(rotation));
topRight.randomize();
pieces.add(topRight);
}
if (twoFloors && random.nextBoolean()) {
final StructurePiece topLeft = getNextPiece();
topLeft.setPosition(position.add(rotate(4, 4, 3)));
topLeft.setRotation(Quaternionf.fromAngleDegAxis(90, 0, 1, 0).mul(rotation));
topLeft.randomize();
pieces.add(topLeft);
}
if (twoFloors && random.nextBoolean()) {
final StructurePiece topBack = getNextPiece();
topBack.setPosition(position.add(rotate(2, 4, 0)));
topBack.setRotation(Quaternionf.fromAngleDegAxis(180, 0, 1, 0).mul(rotation));
topBack.randomize();
pieces.add(topBack);
}
return pieces;
}