Package org.terasology.engine

Examples of org.terasology.engine.SimpleUri


                    Module selectedGameplayModule = gameplay.getSelection();
                    if (selectedGameplayModule != null) {
                        String defaultWorldGenerator = selectedGameplayModule.getMetadata().getExtension(ModuleManager.DEFAULT_WORLD_GENERATOR_EXT, String.class);
                        if (defaultWorldGenerator != null) {
                            for (WorldGeneratorInfo worldGenInfo : worldGeneratorManager.getWorldGenerators()) {
                                if (worldGenInfo.getUri().equals(new SimpleUri(defaultWorldGenerator))) {
                                    set(worldGenInfo);
                                    return worldGenInfo;
                                }
                            }
                        }
View Full Code Here


            moduleConfig.removeModule(previousModule.getId());
        }
        moduleConfig.addModule(module.getId());

        if (!moduleConfig.hasModule(config.getWorldGeneration().getDefaultGenerator().getModuleName())) {
            config.getWorldGeneration().setDefaultGenerator(new SimpleUri());
        }
        config.save();
    }
View Full Code Here

            // transfer all world generation parameters from Config to WorldEntity
            WorldGenerator worldGenerator = CoreRegistry.get(WorldGenerator.class);
            Optional<WorldConfigurator> ocf = worldGenerator.getConfigurator();

            if (ocf.isPresent()) {
                SimpleUri generatorUri = worldGenerator.getUri();
                Config config = CoreRegistry.get(Config.class);

                // get the map of properties from the world generator.  Replace its values with values from the config set by the UI.
                // Also set all the components to the world entity.
                Map<String, Component> params = ocf.get().getProperties();
View Full Code Here

    public DefaultWorldGeneratorPluginLibrary(ModuleEnvironment moduleEnvironment, ReflectFactory reflectFactory, CopyStrategyLibrary copyStrategyLibrary) {
        library = new DefaultClassLibrary<>(reflectFactory, copyStrategyLibrary);
        for (Class entry : moduleEnvironment.getTypesAnnotatedWith(RegisterPlugin.class)) {
            if (WorldGeneratorPlugin.class.isAssignableFrom(entry)) {
                library.register(new SimpleUri(moduleEnvironment.getModuleProviding(entry), entry.getSimpleName()), entry);
            }
        }
    }
View Full Code Here

            // find the first gameplay module that is available, it should have a preferred world gen
            for (Name moduleName : config.getDefaultModSelection().listModules()) {
                Module module = moduleManager.getRegistry().getLatestModuleVersion(moduleName);
                if (moduleManager.isGameplayModule(module)) {
                    String defaultWorldGenerator = module.getMetadata().getExtension(ModuleManager.DEFAULT_WORLD_GENERATOR_EXT, String.class);
                    worldGenConfig.setDefaultGenerator(new SimpleUri(defaultWorldGenerator));
                    break;
                }
            }
        }
        SimpleUri worldGeneratorUri = worldGenConfig.getDefaultGenerator();

        gameManifest.setTitle(worldGenConfig.getWorldTitle());
        gameManifest.setSeed(worldGenConfig.getDefaultSeed());

        WorldInfo worldInfo = new WorldInfo(TerasologyConstants.MAIN_WORLD, gameManifest.getSeed(),
View Full Code Here

                    try (ModuleEnvironment tempEnvironment = moduleManager.loadEnvironment(resolutionResult.getModules(), false)) {
                        for (Class<?> generatorClass : tempEnvironment.getTypesAnnotatedWith(RegisterWorldGenerator.class)) {
                            if (tempEnvironment.getModuleProviding(generatorClass).equals(module.getId())) {
                                RegisterWorldGenerator annotation = generatorClass.getAnnotation(RegisterWorldGenerator.class);
                                if (isValidWorldGenerator(generatorClass)) {
                                    SimpleUri uri = new SimpleUri(moduleId, annotation.id());
                                    infos.add(new WorldGeneratorInfo(uri, annotation.displayName(), annotation.description()));
                                } else {
                                    logger.error("{} marked to be registered as a World Generator, but is not a subclass of WorldGenerator or lacks the correct constructor",
                                            generatorClass);
                                }
View Full Code Here

    }

    private WorldGenerator searchForWorldGenerator(SimpleUri uri, ModuleEnvironment environment) throws UnresolvedWorldGeneratorException {
        for (Class<?> generatorClass : environment.getTypesAnnotatedWith(RegisterWorldGenerator.class)) {
            RegisterWorldGenerator annotation = generatorClass.getAnnotation(RegisterWorldGenerator.class);
            SimpleUri generatorUri = new SimpleUri(environment.getModuleProviding(generatorClass), annotation.id());
            if (generatorUri.equals(uri)) {
                return loadGenerator(generatorClass, generatorUri);
            }
        }
        throw new UnresolvedWorldGeneratorException("Unable to resolve world generator '" + uri + "' - not found");
    }
View Full Code Here

                            inputCategories.put(module.getId() + ":" + inputCategory.id(), inputCategory);
                        }
                        for (Class<?> bindEvent : environment.getTypesAnnotatedWith(RegisterBindButton.class, new FromModule(environment, moduleId))) {
                            if (BindButtonEvent.class.isAssignableFrom(bindEvent)) {
                                RegisterBindButton bindRegister = bindEvent.getAnnotation(RegisterBindButton.class);
                                inputsById.put(new SimpleUri(module.getId(), bindRegister.id()), bindRegister);
                            }
                        }
                    }
                }
View Full Code Here

            layout.addWidget(categoryHeader);

            Set<SimpleUri> processedBinds = Sets.newHashSet();

            for (String bindId : category.ordering()) {
                SimpleUri bindUri = new SimpleUri(bindId);
                if (bindUri.isValid()) {
                    RegisterBindButton bind = inputsById.get(new SimpleUri(bindId));
                    if (bind != null) {
                        addInputBindRow(bindUri, bind, layout);
                        processedBinds.add(bindUri);
                    }
                }
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.