Search in sources :

Example 21 with SimpleUri

use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.

the class EnvironmentSwitchHandler method registerComponents.

private static void registerComponents(ComponentLibrary library, ModuleEnvironment environment) {
    for (Class<? extends Component> componentType : environment.getSubtypesOf(Component.class)) {
        if (componentType.getAnnotation(DoNotAutoRegister.class) == null) {
            String componentName = MetadataUtil.getComponentClassName(componentType);
            library.register(new SimpleUri(environment.getModuleProviding(componentType), componentName), componentType);
        }
    }
}
Also used : DoNotAutoRegister(org.terasology.entitySystem.systems.internal.DoNotAutoRegister) SimpleUri(org.terasology.engine.SimpleUri)

Example 22 with SimpleUri

use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.

the class BindCommands method dvorak.

@Command(shortDescription = "Switches to typical keybinds for DVORAK", requiredPermission = PermissionManager.NO_PERMISSION)
public String dvorak() {
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.COMMA, new SimpleUri("engine:forwards"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.A, new SimpleUri("engine:left"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.O, new SimpleUri("engine:backwards"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.E, new SimpleUri("engine:right"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.C, new SimpleUri("engine:inventory"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.PERIOD, new SimpleUri("engine:useItem"));
    return "Changed key bindings to DVORAK keyboard layout.";
}
Also used : SimpleUri(org.terasology.engine.SimpleUri) Command(org.terasology.logic.console.commandSystem.annotations.Command)

Example 23 with SimpleUri

use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.

the class BindCommands method neo.

@Command(shortDescription = "Switches to typical key binds for NEO 2 keyboard layout", requiredPermission = PermissionManager.NO_PERMISSION)
public String neo() {
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.V, new SimpleUri("engine:forwards"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.I, new SimpleUri("engine:backwards"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.U, new SimpleUri("engine:left"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.A, new SimpleUri("engine:right"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.L, new SimpleUri("engine:useItem"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.G, new SimpleUri("engine:inventory"));
    return "Changed key bindings to NEO 2 keyboard layout.";
}
Also used : SimpleUri(org.terasology.engine.SimpleUri) Command(org.terasology.logic.console.commandSystem.annotations.Command)

Example 24 with SimpleUri

use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.

the class BindCommands method azerty.

@Command(shortDescription = "Switches to typical key binds for AZERTY", requiredPermission = PermissionManager.NO_PERMISSION)
public String azerty() {
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.Z, new SimpleUri("engine:forwards"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.S, new SimpleUri("engine:backwards"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.Q, new SimpleUri("engine:left"));
    return "Changed key bindings to AZERTY keyboard layout.";
}
Also used : SimpleUri(org.terasology.engine.SimpleUri) Command(org.terasology.logic.console.commandSystem.annotations.Command)

Example 25 with SimpleUri

use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.

the class ComponentSerializerTest method setup.

@Before
public void setup() {
    context = new ContextImpl();
    context.put(ModuleManager.class, moduleManager);
    CoreRegistry.setContext(context);
    TypeSerializationLibrary serializationLibrary = new TypeSerializationLibrary(reflectFactory, copyStrategyLibrary);
    serializationLibrary.add(Vector3f.class, new Vector3fTypeHandler());
    serializationLibrary.add(Quat4f.class, new Quat4fTypeHandler());
    NetworkSystem networkSystem = mock(NetworkSystem.class);
    context.put(NetworkSystem.class, networkSystem);
    EntitySystemSetupUtil.addReflectionBasedLibraries(context);
    EntitySystemSetupUtil.addEntityManagementRelatedClasses(context);
    EngineEntityManager entityManager = context.get(EngineEntityManager.class);
    entityManager.getComponentLibrary().register(new SimpleUri("test", "gettersetter"), GetterSetterComponent.class);
    entityManager.getComponentLibrary().register(new SimpleUri("test", "string"), StringComponent.class);
    entityManager.getComponentLibrary().register(new SimpleUri("test", "integer"), IntegerComponent.class);
    ComponentLibrary componentLibrary = entityManager.getComponentLibrary();
    componentSerializer = new ComponentSerializer(componentLibrary, serializationLibrary);
}
Also used : EngineEntityManager(org.terasology.entitySystem.entity.internal.EngineEntityManager) Vector3fTypeHandler(org.terasology.persistence.typeHandling.mathTypes.Vector3fTypeHandler) NetworkSystem(org.terasology.network.NetworkSystem) SimpleUri(org.terasology.engine.SimpleUri) ComponentLibrary(org.terasology.entitySystem.metadata.ComponentLibrary) TypeSerializationLibrary(org.terasology.persistence.typeHandling.TypeSerializationLibrary) Quat4fTypeHandler(org.terasology.persistence.typeHandling.mathTypes.Quat4fTypeHandler) ContextImpl(org.terasology.context.internal.ContextImpl) ComponentSerializer(org.terasology.persistence.serializers.ComponentSerializer) Before(org.junit.Before)

Aggregations

SimpleUri (org.terasology.engine.SimpleUri)71 Test (org.junit.Test)18 Map (java.util.Map)10 Name (org.terasology.naming.Name)9 ResourceUrn (org.terasology.assets.ResourceUrn)7 DefaultClassMetadata (org.terasology.reflection.metadata.DefaultClassMetadata)7 Config (org.terasology.config.Config)6 Input (org.terasology.input.Input)6 FBO (org.terasology.rendering.opengl.FBO)6 ModuleManager (org.terasology.engine.module.ModuleManager)5 Command (org.terasology.logic.console.commandSystem.annotations.Command)5 ModuleEnvironment (org.terasology.module.ModuleEnvironment)5 List (java.util.List)4 DependencyResolver (org.terasology.module.DependencyResolver)4 ResolutionResult (org.terasology.module.ResolutionResult)4 UILabel (org.terasology.rendering.nui.widgets.UILabel)4 Lists (com.google.common.collect.Lists)3 IOException (java.io.IOException)3 Type (java.lang.reflect.Type)3 Locale (java.util.Locale)3