Search in sources :

Example 1 with RoofedForestPopulator

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

the class MixinBiomeForest method buildPopulators.

@Override
public void buildPopulators(World world, SpongeBiomeGenerationSettings gensettings) {
    BiomeDecorator theBiomeDecorator = this.decorator;
    int base = -3;
    if (this.type == BiomeForest.Type.FLOWER) {
        base = -1;
    }
    DoublePlant plant = DoublePlant.builder().perChunk(VariableAmount.baseWithRandomAddition(base * 5, 5 * 5)).type(DoublePlantTypes.SYRINGA, 1).type(DoublePlantTypes.ROSE, 1).type(DoublePlantTypes.PAEONIA, 1).build();
    gensettings.getPopulators().add(plant);
    super.buildPopulators(world, gensettings);
    gensettings.getPopulators().removeAll(gensettings.getPopulators(Forest.class));
    if (this.type == BiomeForest.Type.ROOFED) {
        RoofedForestPopulator forest = new RoofedForestPopulator();
        gensettings.getPopulators().add(0, forest);
    } else {
        Forest.Builder forest = Forest.builder();
        forest.perChunk(VariableAmount.baseWithOptionalAddition(theBiomeDecorator.treesPerChunk, 1, 0.1));
        if (this.type == BiomeForest.Type.BIRCH) {
            forest.type(BiomeTreeTypes.BIRCH.getPopulatorObject(), 1);
        } else {
            forest.type(BiomeTreeTypes.OAK.getPopulatorObject(), 4);
            forest.type(BiomeTreeTypes.BIRCH.getPopulatorObject(), 1);
        }
        gensettings.getPopulators().add(0, forest.build());
    }
    if (this.type == BiomeForest.Type.FLOWER) {
        gensettings.getPopulators().removeAll(gensettings.getPopulators(Flower.class));
        Flower flower = Flower.builder().perChunk(theBiomeDecorator.flowersPerChunk * 64).supplier(new FlowerForestSupplier()).build();
        gensettings.getPopulators().add(flower);
    }
}
Also used : RoofedForestPopulator(org.spongepowered.common.world.gen.populators.RoofedForestPopulator) Flower(org.spongepowered.api.world.gen.populator.Flower) FlowerForestSupplier(org.spongepowered.common.world.gen.populators.FlowerForestSupplier) Forest(org.spongepowered.api.world.gen.populator.Forest) BiomeForest(net.minecraft.world.biome.BiomeForest) BiomeDecorator(net.minecraft.world.biome.BiomeDecorator) DoublePlant(org.spongepowered.api.world.gen.populator.DoublePlant)

Aggregations

BiomeDecorator (net.minecraft.world.biome.BiomeDecorator)1 BiomeForest (net.minecraft.world.biome.BiomeForest)1 DoublePlant (org.spongepowered.api.world.gen.populator.DoublePlant)1 Flower (org.spongepowered.api.world.gen.populator.Flower)1 Forest (org.spongepowered.api.world.gen.populator.Forest)1 FlowerForestSupplier (org.spongepowered.common.world.gen.populators.FlowerForestSupplier)1 RoofedForestPopulator (org.spongepowered.common.world.gen.populators.RoofedForestPopulator)1