Search in sources :

Example 1 with TallGrass

use of net.glowstone.generator.objects.TallGrass in project Glowstone by GlowstoneMC.

the class TallGrassDecorator method decorate.

@Override
public void decorate(World world, Random random, Chunk source) {
    int sourceX = (source.getX() << 4) + random.nextInt(16);
    int sourceZ = (source.getZ() << 4) + random.nextInt(16);
    int sourceY = random.nextInt(Math.abs(world.getHighestBlockYAt(sourceX, sourceZ) << 1));
    // the grass species can change on each decoration pass
    GrassSpecies species = GrassSpecies.NORMAL;
    if (fernDensity > 0 && random.nextFloat() < fernDensity) {
        species = GrassSpecies.FERN_LIKE;
    }
    new TallGrass(new LongGrass(species)).generate(world, random, sourceX, sourceY, sourceZ);
}
Also used : GrassSpecies(org.bukkit.GrassSpecies) TallGrass(net.glowstone.generator.objects.TallGrass) LongGrass(org.bukkit.material.LongGrass)

Example 2 with TallGrass

use of net.glowstone.generator.objects.TallGrass in project Glowstone by GlowstoneMC.

the class PlainsPopulator method populateOnGround.

@Override
public void populateOnGround(World world, Random random, Chunk chunk) {
    int sourceX = chunk.getX() << 4;
    int sourceZ = chunk.getZ() << 4;
    int flowerAmount = 15;
    int tallGrassAmount = 5;
    if (noiseGen.noise(sourceX + 8, sourceZ + 8, 0.5D, 2.0D) >= -0.8D) {
        flowerAmount = 4;
        tallGrassAmount = 10;
        for (int i = 0; i < 7; i++) {
            int x = sourceX + random.nextInt(16);
            int z = sourceZ + random.nextInt(16);
            int y = random.nextInt(world.getHighestBlockYAt(x, z) + 32);
            new DoubleTallPlant(DoublePlantSpecies.DOUBLE_TALLGRASS).generate(world, random, x, y, z);
        }
    }
    FlowerType flower = FlowerType.DANDELION;
    if (noiseGen.noise(sourceX + 8, sourceZ + 8, 0.5D, 2.0D) < -0.8D) {
        flower = TULIPS[random.nextInt(TULIPS.length)];
    } else if (random.nextInt(3) > 0) {
        flower = FLOWERS[random.nextInt(FLOWERS.length)];
    }
    for (int i = 0; i < flowerAmount; i++) {
        int x = sourceX + random.nextInt(16);
        int z = sourceZ + random.nextInt(16);
        int y = random.nextInt(world.getHighestBlockYAt(x, z) + 32);
        new Flower(flower).generate(world, random, x, y, z);
    }
    for (int i = 0; i < tallGrassAmount; i++) {
        int x = sourceX + random.nextInt(16);
        int z = sourceZ + random.nextInt(16);
        int y = random.nextInt(world.getHighestBlockYAt(x, z) << 1);
        new TallGrass(new LongGrass(GrassSpecies.NORMAL)).generate(world, random, x, y, z);
    }
    super.populateOnGround(world, random, chunk);
}
Also used : Flower(net.glowstone.generator.objects.Flower) FlowerType(net.glowstone.generator.objects.FlowerType) TallGrass(net.glowstone.generator.objects.TallGrass) DoubleTallPlant(net.glowstone.generator.objects.DoubleTallPlant) LongGrass(org.bukkit.material.LongGrass)

Aggregations

TallGrass (net.glowstone.generator.objects.TallGrass)2 LongGrass (org.bukkit.material.LongGrass)2 DoubleTallPlant (net.glowstone.generator.objects.DoubleTallPlant)1 Flower (net.glowstone.generator.objects.Flower)1 FlowerType (net.glowstone.generator.objects.FlowerType)1 GrassSpecies (org.bukkit.GrassSpecies)1