Search in sources :

Example 1 with ModuleManagerImpl

use of org.terasology.engine.module.ModuleManagerImpl in project Terasology by MovingBlocks.

the class ModuleManagerFactory method create.

public static ModuleManager create() throws Exception {
    ModuleManager moduleManager = new ModuleManagerImpl("");
    try (Reader reader = new InputStreamReader(ModuleManagerFactory.class.getResourceAsStream("/module.txt"), TerasologyConstants.CHARSET)) {
        ModuleMetadata metadata = new ModuleMetadataReader().read(reader);
        moduleManager.getRegistry().add(ClasspathModule.create(metadata, ModuleManagerFactory.class));
    }
    moduleManager.loadEnvironment(Sets.newHashSet(moduleManager.getRegistry().getLatestModuleVersion(new Name("engine"))), true);
    return moduleManager;
}
Also used : ModuleManagerImpl(org.terasology.engine.module.ModuleManagerImpl) InputStreamReader(java.io.InputStreamReader) ModuleMetadata(org.terasology.module.ModuleMetadata) Reader(java.io.Reader) ModuleMetadataReader(org.terasology.module.ModuleMetadataReader) InputStreamReader(java.io.InputStreamReader) ModuleManager(org.terasology.engine.module.ModuleManager) ModuleMetadataReader(org.terasology.module.ModuleMetadataReader) Name(org.terasology.naming.Name)

Example 2 with ModuleManagerImpl

use of org.terasology.engine.module.ModuleManagerImpl in project Terasology by MovingBlocks.

the class TerasologyEngine method initManagers.

private void initManagers() {
    changeStatus(TerasologyEngineStatus.INITIALIZING_MODULE_MANAGER);
    ModuleManager moduleManager = new ModuleManagerImpl(rootContext.get(Config.class));
    rootContext.put(ModuleManager.class, moduleManager);
    changeStatus(TerasologyEngineStatus.INITIALIZING_LOWLEVEL_OBJECT_MANIPULATION);
    ReflectFactory reflectFactory = new ReflectionReflectFactory();
    rootContext.put(ReflectFactory.class, reflectFactory);
    CopyStrategyLibrary copyStrategyLibrary = new CopyStrategyLibrary(reflectFactory);
    rootContext.put(CopyStrategyLibrary.class, copyStrategyLibrary);
    rootContext.put(TypeSerializationLibrary.class, new TypeSerializationLibrary(reflectFactory, copyStrategyLibrary));
    changeStatus(TerasologyEngineStatus.INITIALIZING_ASSET_TYPES);
    assetTypeManager = new ModuleAwareAssetTypeManager();
    rootContext.put(ModuleAwareAssetTypeManager.class, assetTypeManager);
    rootContext.put(AssetManager.class, assetTypeManager.getAssetManager());
}
Also used : ReflectionReflectFactory(org.terasology.reflection.reflect.ReflectionReflectFactory) ReflectionReflectFactory(org.terasology.reflection.reflect.ReflectionReflectFactory) ReflectFactory(org.terasology.reflection.reflect.ReflectFactory) ModuleManagerImpl(org.terasology.engine.module.ModuleManagerImpl) Config(org.terasology.config.Config) ModuleAwareAssetTypeManager(org.terasology.assets.module.ModuleAwareAssetTypeManager) CopyStrategyLibrary(org.terasology.reflection.copy.CopyStrategyLibrary) TypeSerializationLibrary(org.terasology.persistence.typeHandling.TypeSerializationLibrary) ModuleManager(org.terasology.engine.module.ModuleManager)

Aggregations

ModuleManager (org.terasology.engine.module.ModuleManager)2 ModuleManagerImpl (org.terasology.engine.module.ModuleManagerImpl)2 InputStreamReader (java.io.InputStreamReader)1 Reader (java.io.Reader)1 ModuleAwareAssetTypeManager (org.terasology.assets.module.ModuleAwareAssetTypeManager)1 Config (org.terasology.config.Config)1 ModuleMetadata (org.terasology.module.ModuleMetadata)1 ModuleMetadataReader (org.terasology.module.ModuleMetadataReader)1 Name (org.terasology.naming.Name)1 TypeSerializationLibrary (org.terasology.persistence.typeHandling.TypeSerializationLibrary)1 CopyStrategyLibrary (org.terasology.reflection.copy.CopyStrategyLibrary)1 ReflectFactory (org.terasology.reflection.reflect.ReflectFactory)1 ReflectionReflectFactory (org.terasology.reflection.reflect.ReflectionReflectFactory)1