Search in sources :

Example 1 with AnimalPopulator

use of org.spongepowered.common.world.gen.populators.AnimalPopulator in project SpongeCommon by SpongePowered.

the class MixinChunkGeneratorOverworld method addPopulators.

@Override
public void addPopulators(WorldGenerator generator) {
    if (this.settings.useCaves) {
        generator.getGenerationPopulators().add((GenerationPopulator) this.caveGenerator);
    }
    if (this.settings.useRavines) {
        generator.getGenerationPopulators().add((GenerationPopulator) this.ravineGenerator);
    }
    if (this.settings.useMineShafts && this.mapFeaturesEnabled) {
        generator.getGenerationPopulators().add((GenerationPopulator) this.mineshaftGenerator);
        generator.getPopulators().add((Populator) this.mineshaftGenerator);
    }
    if (this.settings.useVillages && this.mapFeaturesEnabled) {
        generator.getGenerationPopulators().add((GenerationPopulator) this.villageGenerator);
        generator.getPopulators().add((Populator) this.villageGenerator);
    }
    if (this.settings.useStrongholds && this.mapFeaturesEnabled) {
        generator.getGenerationPopulators().add((GenerationPopulator) this.strongholdGenerator);
        generator.getPopulators().add((Populator) this.strongholdGenerator);
    }
    if (this.settings.useTemples && this.mapFeaturesEnabled) {
        generator.getGenerationPopulators().add((GenerationPopulator) this.scatteredFeatureGenerator);
        generator.getPopulators().add((Populator) this.scatteredFeatureGenerator);
    }
    if (this.settings.useMonuments && this.mapFeaturesEnabled) {
        generator.getGenerationPopulators().add((GenerationPopulator) this.oceanMonumentGenerator);
        generator.getPopulators().add((Populator) this.oceanMonumentGenerator);
    }
    if (this.settings.useMansions && this.mapFeaturesEnabled) {
        generator.getGenerationPopulators().add((GenerationPopulator) this.woodlandMansionGenerator);
        generator.getPopulators().add((Populator) this.woodlandMansionGenerator);
    }
    if (this.settings.useWaterLakes) {
        Lake lake = Lake.builder().chance(1d / this.settings.waterLakeChance).liquidType((BlockState) Blocks.WATER.getDefaultState()).height(VariableAmount.baseWithRandomAddition(0, 256)).build();
        FilteredPopulator filtered = new FilteredPopulator(lake, (c) -> {
            Biome biomegenbase = this.world.getBiome(VecHelper.toBlockPos(c.getBlockMin()).add(16, 0, 16));
            return biomegenbase != Biomes.DESERT && biomegenbase != Biomes.DESERT_HILLS;
        });
        filtered.setRequiredFlags(WorldGenConstants.VILLAGE_FLAG);
        generator.getPopulators().add(filtered);
    }
    if (this.settings.useLavaLakes) {
        Lake lake = Lake.builder().chance(1d / this.settings.lavaLakeChance).liquidType((BlockState) Blocks.WATER.getDefaultState()).height(VariableAmount.baseWithVariance(0, VariableAmount.baseWithRandomAddition(8, VariableAmount.baseWithOptionalAddition(55, 193, 0.1)))).build();
        FilteredPopulator filtered = new FilteredPopulator(lake);
        filtered.setRequiredFlags(WorldGenConstants.VILLAGE_FLAG);
        generator.getPopulators().add(filtered);
    }
    if (this.settings.useDungeons) {
        Dungeon dungeon = Dungeon.builder().attempts(this.settings.dungeonChance).build();
        generator.getPopulators().add(dungeon);
    }
    generator.getPopulators().add(new AnimalPopulator());
    generator.getPopulators().add(new SnowPopulator());
}
Also used : FilteredPopulator(org.spongepowered.common.world.gen.populators.FilteredPopulator) Biome(net.minecraft.world.biome.Biome) Dungeon(org.spongepowered.api.world.gen.populator.Dungeon) SnowPopulator(org.spongepowered.common.world.gen.populators.SnowPopulator) Lake(org.spongepowered.api.world.gen.populator.Lake) AnimalPopulator(org.spongepowered.common.world.gen.populators.AnimalPopulator)

Aggregations

Biome (net.minecraft.world.biome.Biome)1 Dungeon (org.spongepowered.api.world.gen.populator.Dungeon)1 Lake (org.spongepowered.api.world.gen.populator.Lake)1 AnimalPopulator (org.spongepowered.common.world.gen.populators.AnimalPopulator)1 FilteredPopulator (org.spongepowered.common.world.gen.populators.FilteredPopulator)1 SnowPopulator (org.spongepowered.common.world.gen.populators.SnowPopulator)1