Search in sources :

Example 11 with ResolutionResult

use of org.terasology.module.ResolutionResult in project Terasology by MovingBlocks.

the class ModuleDownloadListGenerator method getAllModulesToDownloadFor.

Set<Module> getAllModulesToDownloadFor(Name... modulesToInstall) throws DependencyResolutionFailedException {
    Version currentEngineVersion = localRegistry.getLatestModuleVersion(TerasologyConstants.ENGINE_MODULE).getVersion();
    ResolutionResult resolutionResult = remoteDependencyResolver.builder().requireVersion(TerasologyConstants.ENGINE_MODULE, currentEngineVersion).requireAll(modulesToInstall).build();
    return processResolutionResult(resolutionResult);
}
Also used : Version(org.terasology.naming.Version) ResolutionResult(org.terasology.module.ResolutionResult)

Example 12 with ResolutionResult

use of org.terasology.module.ResolutionResult in project Terasology by MovingBlocks.

the class BindsSubsystem method updateDefaultBinds.

private void updateDefaultBinds(Context passedContext, BindsConfiguration config) {
    ModuleManager moduleManager = passedContext.get(ModuleManager.class);
    DependencyResolver resolver = new DependencyResolver(moduleManager.getRegistry());
    for (Name moduleId : moduleManager.getRegistry().getModuleIds()) {
        if (moduleManager.getRegistry().getLatestModuleVersion(moduleId).isCodeModule()) {
            ResolutionResult result = resolver.resolve(moduleId);
            if (result.isSuccess()) {
                try (ModuleEnvironment environment = moduleManager.loadEnvironment(result.getModules(), false)) {
                    FromModule filter = new FromModule(environment, moduleId);
                    Iterable<Class<?>> buttons = environment.getTypesAnnotatedWith(RegisterBindButton.class, filter);
                    Iterable<Class<?>> axes = environment.getTypesAnnotatedWith(RegisterRealBindAxis.class, filter);
                    addButtonDefaultsFor(moduleId, buttons, config);
                    addAxisDefaultsFor(moduleId, axes, config);
                }
            }
        }
    }
}
Also used : ModuleEnvironment(org.terasology.module.ModuleEnvironment) ResolutionResult(org.terasology.module.ResolutionResult) ModuleManager(org.terasology.engine.module.ModuleManager) FromModule(org.terasology.module.predicates.FromModule) DependencyResolver(org.terasology.module.DependencyResolver) Name(org.terasology.naming.Name)

Aggregations

ResolutionResult (org.terasology.module.ResolutionResult)12 DependencyResolver (org.terasology.module.DependencyResolver)11 ModuleEnvironment (org.terasology.module.ModuleEnvironment)9 ModuleManager (org.terasology.engine.module.ModuleManager)7 Module (org.terasology.module.Module)7 Name (org.terasology.naming.Name)6 FromModule (org.terasology.module.predicates.FromModule)4 SimpleUri (org.terasology.engine.SimpleUri)3 HashSet (java.util.HashSet)2 List (java.util.List)2 EnvironmentSwitchHandler (org.terasology.engine.bootstrap.EnvironmentSwitchHandler)2 UISlider (org.terasology.rendering.nui.widgets.UISlider)2 UnresolvedWorldGeneratorException (org.terasology.world.generator.UnresolvedWorldGeneratorException)2 Lists (com.google.common.collect.Lists)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ByteBuffer (java.nio.ByteBuffer)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Set (java.util.Set)1 Callable (java.util.concurrent.Callable)1