Search in sources :

Example 1 with Vine

use of org.spongepowered.api.world.gen.populator.Vine in project SpongeCommon by SpongePowered.

the class MixinBiomeJungle method buildPopulators.

@Override
public void buildPopulators(World world, SpongeBiomeGenerationSettings gensettings) {
    super.buildPopulators(world, gensettings);
    BiomeDecorator theBiomeDecorator = this.decorator;
    for (Iterator<Populator> it = gensettings.getPopulators().iterator(); it.hasNext(); ) {
        Populator next = it.next();
        if (next instanceof Shrub) {
            Shrub s = (Shrub) next;
            if (s.getTypes().size() == 1) {
                TableEntry<ShrubType> entry = s.getTypes().getEntries().get(0);
                if (entry instanceof WeightedObject && ((WeightedObject<ShrubType>) entry).get() == ShrubTypes.TALL_GRASS) {
                    it.remove();
                }
            }
        }
    }
    Shrub grass = Shrub.builder().perChunk(theBiomeDecorator.grassPerChunk * 128).type(ShrubTypes.FERN, 1).type(ShrubTypes.TALL_GRASS, 3).build();
    gensettings.getPopulators().add(grass);
    Melon melon = Melon.builder().perChunk(64).build();
    gensettings.getPopulators().add(melon);
    Vine vine = Vine.builder().perChunk(50).build();
    gensettings.getPopulators().add(vine);
    gensettings.getPopulators().removeAll(gensettings.getPopulators(Forest.class));
    Forest.Builder forest = Forest.builder();
    forest.perChunk(VariableAmount.baseWithOptionalAddition(theBiomeDecorator.treesPerChunk, 1, 0.1));
    forest.type(BiomeTreeTypes.OAK.getLargePopulatorObject().get(), 1);
    forest.type(BiomeTreeTypes.JUNGLE_BUSH.getPopulatorObject(), 4.5);
    if (!this.isEdge) {
        forest.type(BiomeTreeTypes.JUNGLE.getLargePopulatorObject().get(), 1.2);
        forest.type(BiomeTreeTypes.JUNGLE.getPopulatorObject(), 3);
    } else {
        forest.type(BiomeTreeTypes.JUNGLE.getPopulatorObject(), 4.5);
    }
    gensettings.getPopulators().add(0, forest.build());
}
Also used : ShrubType(org.spongepowered.api.data.type.ShrubType) Vine(org.spongepowered.api.world.gen.populator.Vine) WeightedObject(org.spongepowered.api.util.weighted.WeightedObject) Shrub(org.spongepowered.api.world.gen.populator.Shrub) Forest(org.spongepowered.api.world.gen.populator.Forest) Populator(org.spongepowered.api.world.gen.Populator) BiomeDecorator(net.minecraft.world.biome.BiomeDecorator) Melon(org.spongepowered.api.world.gen.populator.Melon)

Example 2 with Vine

use of org.spongepowered.api.world.gen.populator.Vine in project SpongeCommon by SpongePowered.

the class VineBuilder method build.

@Override
public Vine build() throws IllegalStateException {
    Vine vine = (Vine) new WorldGenVines();
    vine.setVinesPerChunk(this.count);
    return vine;
}
Also used : Vine(org.spongepowered.api.world.gen.populator.Vine) WorldGenVines(net.minecraft.world.gen.feature.WorldGenVines)

Aggregations

Vine (org.spongepowered.api.world.gen.populator.Vine)2 BiomeDecorator (net.minecraft.world.biome.BiomeDecorator)1 WorldGenVines (net.minecraft.world.gen.feature.WorldGenVines)1 ShrubType (org.spongepowered.api.data.type.ShrubType)1 WeightedObject (org.spongepowered.api.util.weighted.WeightedObject)1 Populator (org.spongepowered.api.world.gen.Populator)1 Forest (org.spongepowered.api.world.gen.populator.Forest)1 Melon (org.spongepowered.api.world.gen.populator.Melon)1 Shrub (org.spongepowered.api.world.gen.populator.Shrub)1