Package org.terasology.engine

Examples of org.terasology.engine.SimpleUri


            BindsConfig result = new BindsConfig();
            JsonObject inputObj = json.getAsJsonObject();
            for (Map.Entry<String, JsonElement> entry : inputObj.entrySet()) {
                SetMultimap<String, Input> map = context.deserialize(entry.getValue(), SetMultimap.class);
                for (String id : map.keySet()) {
                    SimpleUri uri = new SimpleUri(new Name(entry.getKey()), id);
                    result.data.putAll(uri, map.get(id));
                }
            }
            return result;
        }
View Full Code Here


    private 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);
            }
        }
    }
View Full Code Here

    }

    private void registerEvents(EventSystem eventSystem, ModuleEnvironment environment) {
        for (Class<? extends Event> type : environment.getSubtypesOf(Event.class)) {
            if (type.getAnnotation(DoNotAutoRegister.class) == null) {
                eventSystem.registerEvent(new SimpleUri(environment.getModuleProviding(type), type.getSimpleName()), type);
            }
        }
    }
View Full Code Here

                logger.error("Type {} is not a valid mapped class", typeClass);
                return defaultStrategy;
            }

            try {
                ClassMetadata<?, ?> classMetadata = new DefaultClassMetadata<>(new SimpleUri(), typeClass, reflectFactory, this);
                return new MappedContainerCopyStrategy<>(classMetadata);
            } catch (NoSuchMethodException e) {
                logger.error("Unable to create copy strategy for field of type {}: no publicly accessible default constructor", typeClass.getSimpleName());
                return defaultStrategy;
            }
View Full Code Here

        // Prefabs that still need to be created, by their name
        Map<String, EntityData.Prefab> pendingPrefabs = Maps.newHashMap();
        for (EntityData.Prefab prefabData : globalStore.getPrefabList()) {
            if (!prefabManager.exists(prefabData.getName())) {
                if (!prefabData.hasParentName()) {
                    Module module = environment.get(new SimpleUri(prefabData.getName()).getModuleName());
                    try (ModuleContext.ContextSpan ignored = ModuleContext.setContext(module)) {
                        createPrefab(prefabData);
                    } catch (Exception e) {
                        logger.error("Failed to load prefab {}", prefabData.getName(), e);
                    }
View Full Code Here

        Prefab result = Assets.getPrefab(prefabData.getName());
        if (result == null) {
            if (prefabData.hasParentName() && pendingPrefabs.containsKey(prefabData.getParentName())) {
                loadPrefab(pendingPrefabs.get(prefabData.getParentName()), pendingPrefabs);
            }
            Module module = environment.get(new SimpleUri(prefabData.getName()).getModuleName());
            try (ModuleContext.ContextSpan ignored = ModuleContext.setContext(module)) {
                result = createPrefab(prefabData);
            } catch (Exception e) {
                logger.error("Failed to load prefab {}", prefabData.getParentName(), e);
            }
View Full Code Here

        return null;
    }

    @Override
    public ClassMetadata<? extends T, ?> resolve(String name) {
        SimpleUri uri = new SimpleUri(name);
        if (uri.isValid()) {
            return getMetadata(uri);
        }
        List<ClassMetadata<? extends T, ?>> possibilities = getMetadata(name);
        if (possibilities.size() == 1) {
            return possibilities.get(0);
View Full Code Here

        return null;
    }

    @Override
    public ClassMetadata<? extends T, ?> resolve(String name, Module context) {
        SimpleUri uri = new SimpleUri(name);
        if (uri.isValid()) {
            return getMetadata(uri);
        }
        List<ClassMetadata<? extends T, ?>> possibilities = getMetadata(name);
        switch (possibilities.size()) {
            case 0:
View Full Code Here

    private void updateInputsFor(Name moduleId, Iterable<Class<?>> classes) {
        for (Class<?> buttonEvent : classes) {
            if (ButtonEvent.class.isAssignableFrom(buttonEvent)) {
                RegisterBindButton info = buttonEvent.getAnnotation(RegisterBindButton.class);
                SimpleUri bindUri = new SimpleUri(moduleId, info.id());
                if (!hasBinds(bindUri)) {
                    addBind(moduleId, buttonEvent, info);
                }
            }
        }
View Full Code Here

                if (!data.values().contains(input)) {
                    defaultInputs.add(input);
                }
            }
        }
        SimpleUri bindUri = new SimpleUri(moduleName, info.id());
        setBinds(bindUri, defaultInputs.toArray(new Input[defaultInputs.size()]));
    }
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.