Package org.terasology.world.generator

Examples of org.terasology.world.generator.RegisterWorldGenerator


                ResolutionResult resolutionResult = resolver.resolve(module.getId());
                if (resolutionResult.isSuccess()) {
                    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

TOP

Related Classes of org.terasology.world.generator.RegisterWorldGenerator

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.