Search in sources :

Example 1 with BigMushroom

use of cn.nukkit.level.generator.object.mushroom.BigMushroom in project Nukkit by Nukkit.

the class BlockMushroomBrown method grow.

public boolean grow() {
    this.level.setBlock(this, new BlockAir(), true, false);
    BigMushroom generator = new BigMushroom(0);
    if (generator.generate(this.level, new NukkitRandom(), this)) {
        return true;
    } else {
        this.level.setBlock(this, this, true, false);
        return false;
    }
}
Also used : BigMushroom(cn.nukkit.level.generator.object.mushroom.BigMushroom) NukkitRandom(cn.nukkit.math.NukkitRandom)

Example 2 with BigMushroom

use of cn.nukkit.level.generator.object.mushroom.BigMushroom in project Nukkit by Nukkit.

the class MushroomPopulator 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 BigMushroom(type).generate(level, random, v.setComponents(x, y, z));
    }
}
Also used : BigMushroom(cn.nukkit.level.generator.object.mushroom.BigMushroom) Vector3(cn.nukkit.math.Vector3)

Example 3 with BigMushroom

use of cn.nukkit.level.generator.object.mushroom.BigMushroom in project Nukkit by Nukkit.

the class BlockMushroomRed method grow.

public boolean grow() {
    this.level.setBlock(this, new BlockAir(), true, false);
    BigMushroom generator = new BigMushroom(1);
    if (generator.generate(this.level, new NukkitRandom(), this)) {
        return true;
    } else {
        this.level.setBlock(this, this, true, false);
        return false;
    }
}
Also used : BigMushroom(cn.nukkit.level.generator.object.mushroom.BigMushroom) NukkitRandom(cn.nukkit.math.NukkitRandom)

Aggregations

BigMushroom (cn.nukkit.level.generator.object.mushroom.BigMushroom)3 NukkitRandom (cn.nukkit.math.NukkitRandom)2 Vector3 (cn.nukkit.math.Vector3)1