Search in sources :

Example 21 with ModuleEnvironment

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

the class EnvironmentSwitchHandler method handleSwitchToEmptyEnvironment.

public void handleSwitchToEmptyEnvironment(Context context) {
    ModuleEnvironment environment = context.get(ModuleManager.class).getEnvironment();
    cheapAssetManagerUpdate(context, environment);
}
Also used : ModuleEnvironment(org.terasology.module.ModuleEnvironment) ModuleManager(org.terasology.engine.module.ModuleManager)

Example 22 with ModuleEnvironment

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

the class BindsSubsystemTest method test.

@Test
public void test() {
    ModuleEnvironment environment = mock(ModuleEnvironment.class);
    when(environment.getTypesAnnotatedWith(eq(RegisterBindButton.class), any())).thenReturn(registerBindButtonClasses);
    registerBindButtonClasses.add(TestEventButton.class);
}
Also used : ModuleEnvironment(org.terasology.module.ModuleEnvironment) RegisterBindButton(org.terasology.input.RegisterBindButton) Test(org.junit.Test)

Example 23 with ModuleEnvironment

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

the class BindsSubsystemTest method setUpMockModuleEnvironment.

private void setUpMockModuleEnvironment() {
    ModuleManager moduleManager = mock(ModuleManager.class);
    ModuleRegistry moduleRegistry = new TableModuleRegistry();
    Module module = mock(Module.class);
    when(module.isCodeModule()).thenReturn(true);
    when(module.getId()).thenReturn(new Name(TEST_MODULE));
    when(module.getVersion()).thenReturn(new Version(0, 0, 1, true));
    when(module.getMetadata()).thenReturn(new ModuleMetadata());
    moduleRegistry.add(module);
    when(moduleManager.getRegistry()).thenReturn(moduleRegistry);
    ModuleEnvironment environment = mock(ModuleEnvironment.class);
    when(moduleManager.loadEnvironment(any(), anyBoolean())).thenReturn(environment);
    when(moduleManager.getEnvironment()).thenReturn(environment);
    registerBindButtonClasses = new ArrayList<>();
    when(environment.getTypesAnnotatedWith(eq(RegisterBindButton.class))).thenReturn(registerBindButtonClasses);
    when(environment.getTypesAnnotatedWith(eq(RegisterBindButton.class), any())).thenReturn(registerBindButtonClasses);
    registerRealBindAxisClasses = new ArrayList<>();
    when(environment.getTypesAnnotatedWith(eq(RegisterBindAxis.class))).thenReturn(registerRealBindAxisClasses);
    when(environment.getTypesAnnotatedWith(eq(RegisterBindAxis.class), any())).thenReturn(registerRealBindAxisClasses);
    when(environment.getModuleProviding(any())).thenReturn(new Name(TEST_MODULE));
    context.put(ModuleManager.class, moduleManager);
}
Also used : TableModuleRegistry(org.terasology.module.TableModuleRegistry) Version(org.terasology.naming.Version) ModuleEnvironment(org.terasology.module.ModuleEnvironment) RegisterBindButton(org.terasology.input.RegisterBindButton) RegisterBindAxis(org.terasology.input.RegisterBindAxis) ModuleRegistry(org.terasology.module.ModuleRegistry) TableModuleRegistry(org.terasology.module.TableModuleRegistry) ModuleMetadata(org.terasology.module.ModuleMetadata) ModuleManager(org.terasology.engine.module.ModuleManager) Module(org.terasology.module.Module) Name(org.terasology.naming.Name)

Aggregations

ModuleEnvironment (org.terasology.module.ModuleEnvironment)23 ModuleManager (org.terasology.engine.module.ModuleManager)18 DependencyResolver (org.terasology.module.DependencyResolver)9 Module (org.terasology.module.Module)9 ResolutionResult (org.terasology.module.ResolutionResult)9 Name (org.terasology.naming.Name)8 FromModule (org.terasology.module.predicates.FromModule)5 SimpleUri (org.terasology.engine.SimpleUri)4 RegisterBindButton (org.terasology.input.RegisterBindButton)4 EnvironmentSwitchHandler (org.terasology.engine.bootstrap.EnvironmentSwitchHandler)2 StateMainMenu (org.terasology.engine.modes.StateMainMenu)2 EngineEntityManager (org.terasology.entitySystem.entity.internal.EngineEntityManager)2 RegisterBindAxis (org.terasology.input.RegisterBindAxis)2 NetworkSystem (org.terasology.network.NetworkSystem)2 WorldProvider (org.terasology.world.WorldProvider)2 BiomeManager (org.terasology.world.biomes.BiomeManager)2 BlockManager (org.terasology.world.block.BlockManager)2 UnresolvedWorldGeneratorException (org.terasology.world.generator.UnresolvedWorldGeneratorException)2 WorldInfo (org.terasology.world.internal.WorldInfo)2 Lists (com.google.common.collect.Lists)1