use of org.terasology.engine.config.flexible.AutoConfigTypeHandlerFactory in project Terasology by MovingBlocks.
the class ConfigurationSubsystem method initialise.
@Override
public void initialise(GameEngine engine, Context rootContext) {
// TODO: Put here because of TypeHandlerLibrary dependency,
// might need to move to preInitialise or elsewhere
TypeHandlerLibrary typeHandlerLibrary = rootContext.get(TypeHandlerLibrary.class);
Gson gson = new GsonBuilder().setPrettyPrinting().create();
Serializer<GsonPersistedData> serializer = new Serializer<>(typeHandlerLibrary, new GsonPersistedDataSerializer(), new GsonPersistedDataWriter(gson), new GsonPersistedDataReader(gson));
autoConfigManager = new AutoConfigManager(serializer);
typeHandlerLibrary.addTypeHandlerFactory(new AutoConfigTypeHandlerFactory(typeHandlerLibrary));
rootContext.put(AutoConfigManager.class, autoConfigManager);
autoConfigManager.loadConfigsIn(rootContext);
}
Aggregations