Package org.terasology.rendering.nui.layouts

Examples of org.terasology.rendering.nui.layouts.PropertyLayout


    public void onOpened() {
        super.onOpened();

        CoreRegistry.put(WorldGeneratorPluginLibrary.class, new TempWorldGeneratorPluginLibrary());

        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;
        }

        try {
            WorldGenerator wg = worldGeneratorManager.createGenerator(info.getUri());
            // set the world seed so that partial initialization happens and the facet system has all facet providers
            wg.setWorldSeed("");
            if (wg.getConfigurator().isPresent()) {
                WorldConfigurator worldConfig = wg.getConfigurator().get();

                params = Maps.newHashMap(worldConfig.getProperties());

                for (String key : params.keySet()) {
                    Class<? extends Component> clazz = params.get(key).getClass();
                    Component comp = config.getModuleConfig(generatorUri, key, clazz);
                    if (comp != null) {
                        params.put(key, comp);       // use the data from the config instead of defaults
                    }
                }

                for (String label : params.keySet()) {
                    PropertyProvider<?> provider = new PropertyProvider<>(params.get(label));
                    properties.addPropertyProvider(label, provider);
                }
            } else {
                logger.info(info.getUri().toString() + " does not support configuration");
            }
        } catch (UnresolvedWorldGeneratorException e) {
View Full Code Here

TOP

Related Classes of org.terasology.rendering.nui.layouts.PropertyLayout

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.