if (module != null) {
gameManifest.addModule(module.getId(), module.getVersion());
}
}
WorldGenerationConfig worldGenConfig = config.getWorldGeneration();
// If no valid default world generator set then try to find one - no option to pick one manually in headless
if (!worldGenConfig.getDefaultGenerator().isValid()) {
// find the first gameplay module that is available, it should have a preferred world gen
for (Name moduleName : config.getDefaultModSelection().listModules()) {
Module module = moduleManager.getRegistry().getLatestModuleVersion(moduleName);
if (moduleManager.isGameplayModule(module)) {
String defaultWorldGenerator = module.getMetadata().getExtension(ModuleManager.DEFAULT_WORLD_GENERATOR_EXT, String.class);
worldGenConfig.setDefaultGenerator(new SimpleUri(defaultWorldGenerator));
break;
}
}
}
SimpleUri worldGeneratorUri = worldGenConfig.getDefaultGenerator();
gameManifest.setTitle(worldGenConfig.getWorldTitle());
gameManifest.setSeed(worldGenConfig.getDefaultSeed());
WorldInfo worldInfo = new WorldInfo(TerasologyConstants.MAIN_WORLD, gameManifest.getSeed(),
(long) (WorldTime.DAY_LENGTH * 0.025f), worldGeneratorUri);
gameManifest.addWorld(worldInfo);
return gameManifest;