Package org.terasology.engine

Examples of org.terasology.engine.SimpleUri


    @Before
    public void setup() {

        EntitySystemBuilder builder = new EntitySystemBuilder();
        entityManager = builder.build(moduleManager.getEnvironment(), mock(NetworkSystem.class), new ReflectionReflectFactory());
        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);
        entitySerializer = new EntitySerializer(entityManager);
        componentLibrary = entityManager.getComponentLibrary();

        PrefabData prefabData = new PrefabData();
        prefabData.addComponent(new StringComponent("Value"));
View Full Code Here


        assertEquals(!defaultSetting, newEntity.isAlwaysRelevant());
    }

    @Test
    public void testMappedTypeHandling() throws Exception {
        componentLibrary.register(new SimpleUri("test", "mappedtype"), MappedTypeComponent.class);

        EntityRef entity = entityManager.create();
        entity.addComponent(new MappedTypeComponent());
        EntityData.Entity entityData = entitySerializer.serialize(entity);
        entityManager.clear();
View Full Code Here

    @Test
    public void staticFieldsIgnored() {
        EntitySystemLibrary entitySystemLibrary = new EntitySystemLibrary(reflectFactory, copyStrategies, new TypeSerializationLibrary(reflectFactory, copyStrategies));
        ComponentLibrary lib = entitySystemLibrary.getComponentLibrary();
        lib.register(new SimpleUri("unittest:string"), StringComponent.class);
        ComponentMetadata<StringComponent> metadata = lib.getMetadata(StringComponent.class);
        assertNull(metadata.getField("STATIC_VALUE"));
    }
View Full Code Here

    @Test
    public void ownsReferencesPopulated() {
        EntitySystemLibrary entitySystemLibrary = new EntitySystemLibrary(reflectFactory, copyStrategies, new TypeSerializationLibrary(reflectFactory, copyStrategies));
        ComponentLibrary lib = entitySystemLibrary.getComponentLibrary();
        lib.register(new SimpleUri("unittest:owner"), OwnerComponent.class);
        ComponentMetadata<OwnerComponent> metadata = lib.getMetadata(OwnerComponent.class);
        assertTrue(metadata.isReferenceOwner());
    }
View Full Code Here

    public void refreshWidgetsLibrary() {
        widgetsLibrary = new WidgetLibrary(CoreRegistry.get(ReflectFactory.class), CoreRegistry.get(CopyStrategyLibrary.class));
        ModuleEnvironment environment = CoreRegistry.get(ModuleManager.class).getEnvironment();
        for (Class<? extends UIWidget> type : environment.getSubtypesOf(UIWidget.class)) {
            widgetsLibrary.register(new SimpleUri(environment.getModuleProviding(type), type.getSimpleName()), type);
        }
    }
View Full Code Here

    }

    public void scan(ModuleEnvironment environment) {
        for (Class<? extends Node> entry : environment.getSubtypesOf(Node.class)) {
            logger.debug("Found node class {}", entry);
            register(new SimpleUri(environment.getModuleProviding(entry), entry.getSimpleName()), entry);
        }
    }
View Full Code Here

        PropertyLayout properties = find("properties", PropertyLayout.class);
        properties.setOrdering(PropertyOrdering.byLabel());
        properties.clear();

        SimpleUri generatorUri = config.getWorldGeneration().getDefaultGenerator();
        WorldGeneratorInfo info = worldGeneratorManager.getWorldGeneratorInfo(generatorUri);

        if (info == null) {
            return;
        }
View Full Code Here

        }
    }

    @Override
    public void onClosed() {
        SimpleUri generatorUri = config.getWorldGeneration().getDefaultGenerator();
        if (params != null) {
            config.setModuleConfigs(generatorUri, params);
            params = null;
        }
        super.onClosed();
View Full Code Here

            if (info.isSelected() && info.isExplicitSelection()) {
                moduleConfig.addModule(info.getMetadata().getId());
            }
        }
        if (!moduleConfig.hasModule(config.getWorldGeneration().getDefaultGenerator().getModuleName())) {
            config.getWorldGeneration().setDefaultGenerator(new SimpleUri());
        }
        config.save();
    }
View Full Code Here

            this.target = target;
            Class<?> type = target.getClass();

            ReflectFactory reflectFactory = CoreRegistry.get(ReflectFactory.class);
            CopyStrategyLibrary copyStrategies = new CopyStrategyLibrary(reflectFactory);
            ClassMetadata<?, ?> classMetadata = new DefaultClassMetadata<>(new SimpleUri(), type, reflectFactory, copyStrategies);
            for (Field field : getAllFields(type)) {
                Annotation annotation = getFactory(field);
                if (annotation != null) {
                    FieldMetadata<Object, ?> fieldMetadata = (FieldMetadata<Object, ?>) classMetadata.getField(field.getName());
                    PropertyFactory factory = factories.get(annotation.annotationType());
View Full Code Here

TOP

Related Classes of org.terasology.engine.SimpleUri

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.