cn.nukkit.level.generator.object.mushroom.BigMushroom Java Examples

The following examples show how to use cn.nukkit.level.generator.object.mushroom.BigMushroom. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MushroomPopulator.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
@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));
    }
}
 
Example #2
Source File: MushroomPopulator.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
@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));
    }
}
 
Example #3
Source File: BlockMushroomRed.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
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;
    }
}
 
Example #4
Source File: BlockMushroomBrown.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
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;
    }
}
 
Example #5
Source File: MushroomPopulator.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void populateCount(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random, FullChunk chunk) {
    int x = (chunkX << 4) | random.nextBoundedInt(16);
    int z = (chunkZ << 4) | random.nextBoundedInt(16);
    int y = this.getHighestWorkableBlock(level, x, z, chunk);
    if (y != -1) {
        new BigMushroom(type).generate(level, random, new Vector3(x, y, z));
    }
}
 
Example #6
Source File: BlockMushroom.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public boolean grow() {
    this.level.setBlock(this, Block.get(BlockID.AIR), true, false);

    BigMushroom generator = new BigMushroom(getType());

    if (generator.generate(this.level, new NukkitRandom(), this)) {
        return true;
    } else {
        this.level.setBlock(this, this, true, false);
        return false;
    }
}
 
Example #7
Source File: BlockMushroomRed.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
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;
    }
}
 
Example #8
Source File: BlockMushroomBrown.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
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;
    }
}