PropertyLayout properties = find("properties", PropertyLayout.class);
properties.setOrdering(PropertyOrdering.byLabel());
properties.clear();
SimpleUri generatorUri = config.getWorldGeneration().getDefaultGenerator();
WorldGeneratorInfo info = worldGeneratorManager.getWorldGeneratorInfo(generatorUri);
if (info == null) {
return;
}
try {
WorldGenerator wg = worldGeneratorManager.createGenerator(info.getUri());
// set the world seed so that partial initialization happens and the facet system has all facet providers
wg.setWorldSeed("");
if (wg.getConfigurator().isPresent()) {
WorldConfigurator worldConfig = wg.getConfigurator().get();
params = Maps.newHashMap(worldConfig.getProperties());
for (String key : params.keySet()) {
Class<? extends Component> clazz = params.get(key).getClass();
Component comp = config.getModuleConfig(generatorUri, key, clazz);
if (comp != null) {
params.put(key, comp); // use the data from the config instead of defaults
}
}
for (String label : params.keySet()) {
PropertyProvider<?> provider = new PropertyProvider<>(params.get(label));
properties.addPropertyProvider(label, provider);
}
} else {
logger.info(info.getUri().toString() + " does not support configuration");
}
} catch (UnresolvedWorldGeneratorException e) {
logger.error("Requested unavailable world generator", e);
}
}