Search in sources :

Example 1 with ModuleMetadataReader

use of org.terasology.module.ModuleMetadataReader 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)

Aggregations

InputStreamReader (java.io.InputStreamReader)1 Reader (java.io.Reader)1 ModuleManager (org.terasology.engine.module.ModuleManager)1 ModuleManagerImpl (org.terasology.engine.module.ModuleManagerImpl)1 ModuleMetadata (org.terasology.module.ModuleMetadata)1 ModuleMetadataReader (org.terasology.module.ModuleMetadataReader)1 Name (org.terasology.naming.Name)1