Search in sources :

Example 1 with ObjectJungleBigTree

use of cn.nukkit.level.generator.object.tree.ObjectJungleBigTree in project Nukkit by Nukkit.

the class JungleBigTreePopulator method populate.

@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
    this.level = level;
    int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;
    Vector3 v = new Vector3();
    for (int i = 0; i < amount; ++i) {
        int x = NukkitMath.randomRange(random, chunkX << 4, (chunkX << 4) + 15);
        int z = NukkitMath.randomRange(random, chunkZ << 4, (chunkZ << 4) + 15);
        int y = this.getHighestWorkableBlock(x, z);
        if (y == -1) {
            continue;
        }
        new ObjectJungleBigTree(10, 20, new BlockWood(BlockWood.JUNGLE), new BlockLeaves(BlockLeaves.JUNGLE)).generate(this.level, random, v.setComponents(x, y, z));
    }
}
Also used : BlockLeaves(cn.nukkit.block.BlockLeaves) ObjectJungleBigTree(cn.nukkit.level.generator.object.tree.ObjectJungleBigTree) Vector3(cn.nukkit.math.Vector3) BlockWood(cn.nukkit.block.BlockWood)

Aggregations

BlockLeaves (cn.nukkit.block.BlockLeaves)1 BlockWood (cn.nukkit.block.BlockWood)1 ObjectJungleBigTree (cn.nukkit.level.generator.object.tree.ObjectJungleBigTree)1 Vector3 (cn.nukkit.math.Vector3)1