Search in sources :

Example 6 with GameRegistry

use of org.spongepowered.api.GameRegistry in project LanternServer by LanternPowered.

the class LanternWorldProperties method updateWorldGenModifiers.

public void updateWorldGenModifiers(List<String> modifiers) {
    final ImmutableSet.Builder<WorldGeneratorModifier> genModifiers = ImmutableSet.builder();
    final GameRegistry registry = Sponge.getRegistry();
    for (String modifier : modifiers) {
        Optional<WorldGeneratorModifier> genModifier = registry.getType(WorldGeneratorModifier.class, modifier);
        if (genModifier.isPresent()) {
            genModifiers.add(genModifier.get());
        } else {
            Lantern.getLogger().error("World generator modifier with id " + modifier + " not found. Missing plugin?");
        }
    }
    this.generatorModifiers = genModifiers.build();
}
Also used : WorldGeneratorModifier(org.spongepowered.api.world.gen.WorldGeneratorModifier) ImmutableSet(com.google.common.collect.ImmutableSet) GameRegistry(org.spongepowered.api.GameRegistry)

Aggregations

GameRegistry (org.spongepowered.api.GameRegistry)6 WorldArchetype (org.spongepowered.api.world.WorldArchetype)2 WorldGeneratorModifier (org.spongepowered.api.world.gen.WorldGeneratorModifier)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 Supplier (java.util.function.Supplier)1 Nullable (javax.annotation.Nullable)1 ConfigurationNode (ninja.leaping.configurate.ConfigurationNode)1 ObjectMappingException (ninja.leaping.configurate.objectmapping.ObjectMappingException)1 Listener (org.spongepowered.api.event.Listener)1 TextColor (org.spongepowered.api.text.format.TextColor)1 TextStyle (org.spongepowered.api.text.format.TextStyle)1 DimensionType (org.spongepowered.api.world.DimensionType)1 GeneratorType (org.spongepowered.api.world.GeneratorType)1 World (org.spongepowered.api.world.World)1