use of org.terasology.config.flexible.FlexibleConfig in project Terasology by MovingBlocks.
the class ConfigurationSubsystem method preInitialise.
@Override
public void preInitialise(Context rootContext) {
config = new Config(rootContext);
config.load();
FlexibleConfigManager flexibleConfigManager = new FlexibleConfigManagerImpl();
rootContext.put(FlexibleConfigManager.class, flexibleConfigManager);
// TODO: Update rendering config description
FlexibleConfig renderingFlexibleConfig = new FlexibleConfigImpl("Rendering Config");
flexibleConfigManager.addConfig(new SimpleUri("engine:rendering"), renderingFlexibleConfig);
flexibleConfigManager.loadAllConfigs();
// Add settings to RenderingFC
String serverPortProperty = System.getProperty(SERVER_PORT_PROPERTY);
if (serverPortProperty != null) {
try {
config.getNetwork().setServerPort(Integer.parseInt(serverPortProperty));
} catch (NumberFormatException e) {
logger.error("Failed to set server port to invalid value: {}", serverPortProperty);
}
}
if (Iterables.isEmpty(config.getDefaultModSelection().listModules())) {
config.getDefaultModSelection().addModule(TerasologyConstants.CORE_GAMEPLAY_MODULE);
}
checkServerIdentity();
// TODO: Move to display subsystem
logger.info("Video Settings: {}", config.renderConfigAsJson(config.getRendering()));
rootContext.put(Config.class, config);
// add facades
rootContext.put(InputDeviceConfiguration.class, new InputDeviceConfigurationImpl(config));
rootContext.put(BindsConfiguration.class, new BindsConfigurationImpl(config));
}
Aggregations