cn.nukkit.block.BlockFlower Java Examples

The following examples show how to use cn.nukkit.block.BlockFlower. 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: SwampBiome.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
public SwampBiome() {
    super();

    PopulatorLilyPad lilypad = new PopulatorLilyPad();
    lilypad.setBaseAmount(4);

    SwampTreePopulator trees = new SwampTreePopulator();
    trees.setBaseAmount(2);

    PopulatorFlower flower = new PopulatorFlower();
    flower.setBaseAmount(2);
    flower.addType(Block.RED_FLOWER, BlockFlower.TYPE_BLUE_ORCHID);

    this.addPopulator(trees);
    this.addPopulator(flower);
    this.addPopulator(lilypad);

    this.setElevation(62, 63);

    this.temperature = 0.8;
    this.rainfall = 0.9;
}
 
Example #2
Source File: PopulatorFlower.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;

    if (flowerTypes.size() == 0) {
        this.addType(Block.RED_FLOWER, BlockFlower.TYPE_POPPY);
        this.addType(Block.DANDELION, 0);
    }

    int endNum = this.flowerTypes.size();

    for (int i = 0; i < amount; ++i) {
        int x = NukkitMath.randomRange(random, chunkX * 16, chunkX * 16 + 15);
        int z = NukkitMath.randomRange(random, chunkZ * 16, chunkZ * 16 + 15);
        int y = this.getHighestWorkableBlock(x, z);


        if (y != -1 && this.canFlowerStay(x, y, z)) {
            int[] type = this.flowerTypes.get(random.nextRange(0, endNum - 1));
            this.level.setBlockIdAt(x, y, z, type[0]);
            this.level.setBlockDataAt(x, y, z, type[1]);
        }
    }
}
 
Example #3
Source File: FlowerForestBiome.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
public FlowerForestBiome(int type) {
    super(type);

    //see https://minecraft.gamepedia.com/Flower#Flower_biomes
    PopulatorFlower flower = new PopulatorFlower();
    flower.setBaseAmount(10);
    flower.addType(DANDELION, 0);
    flower.addType(RED_FLOWER, BlockFlower.TYPE_POPPY);
    flower.addType(RED_FLOWER, BlockFlower.TYPE_ALLIUM);
    flower.addType(RED_FLOWER, BlockFlower.TYPE_AZURE_BLUET);
    flower.addType(RED_FLOWER, BlockFlower.TYPE_RED_TULIP);
    flower.addType(RED_FLOWER, BlockFlower.TYPE_ORANGE_TULIP);
    flower.addType(RED_FLOWER, BlockFlower.TYPE_WHITE_TULIP);
    flower.addType(RED_FLOWER, BlockFlower.TYPE_PINK_TULIP);
    flower.addType(RED_FLOWER, BlockFlower.TYPE_OXEYE_DAISY);
    flower.addType(DOUBLE_PLANT, BlockDoublePlant.LILAC);
    flower.addType(DOUBLE_PLANT, BlockDoublePlant.ROSE_BUSH);
    flower.addType(DOUBLE_PLANT, BlockDoublePlant.PEONY);
    this.addPopulator(flower);

    this.setHeightVariation(0.4f);
}
 
Example #4
Source File: SwampBiome.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
public SwampBiome() {
    super();

    PopulatorLilyPad lilypad = new PopulatorLilyPad();
    lilypad.setBaseAmount(4);

    SwampTreePopulator trees = new SwampTreePopulator();
    trees.setBaseAmount(2);

    PopulatorFlower flower = new PopulatorFlower();
    flower.setBaseAmount(2);
    flower.addType(Block.RED_FLOWER, BlockFlower.TYPE_BLUE_ORCHID);

    this.addPopulator(trees);
    this.addPopulator(flower);
    this.addPopulator(lilypad);

    this.setElevation(62, 63);

    this.temperature = 0.8;
    this.rainfall = 0.9;
}
 
Example #5
Source File: PopulatorFlower.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;

    if (flowerTypes.size() == 0) {
        this.addType(Block.RED_FLOWER, BlockFlower.TYPE_POPPY);
        this.addType(Block.DANDELION, 0);
    }

    int endNum = this.flowerTypes.size();

    for (int i = 0; i < amount; ++i) {
        int x = NukkitMath.randomRange(random, chunkX * 16, chunkX * 16 + 15);
        int z = NukkitMath.randomRange(random, chunkZ * 16, chunkZ * 16 + 15);
        int y = this.getHighestWorkableBlock(x, z);


        if (y != -1 && this.canFlowerStay(x, y, z)) {
            int[] type = this.flowerTypes.get(random.nextRange(0, endNum - 1));
            this.level.setBlockIdAt(x, y, z, type[0]);
            this.level.setBlockDataAt(x, y, z, type[1]);
        }
    }
}
 
Example #6
Source File: EntityIronGolem.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item[] getDrops() {
    return new Item[]{
            new ItemIngotIron(0, random.nextRange(3, 5)),
            new BlockFlower(BlockFlower.TYPE_POPPY).toItem().setCount(random.nextRange(0, 2))
    };
}
 
Example #7
Source File: PlainBiome.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
public PlainBiome() {
    super();
    PopulatorSugarcane sugarcane = new PopulatorSugarcane();
    sugarcane.setBaseAmount(6);
    PopulatorTallSugarcane tallSugarcane = new PopulatorTallSugarcane();
    tallSugarcane.setBaseAmount(60);
    PopulatorGrass grass = new PopulatorGrass();
    grass.setBaseAmount(40);
    PopulatorTallGrass tallGrass = new PopulatorTallGrass();
    tallGrass.setBaseAmount(7);
    PopulatorFlower flower = new PopulatorFlower();
    flower.setBaseAmount(10);
    flower.addType(Block.DANDELION, 0);
    flower.addType(Block.RED_FLOWER, BlockFlower.TYPE_POPPY);
    flower.addType(Block.RED_FLOWER, BlockFlower.TYPE_AZURE_BLUET);
    flower.addType(Block.RED_FLOWER, BlockFlower.TYPE_RED_TULIP);
    flower.addType(Block.RED_FLOWER, BlockFlower.TYPE_ORANGE_TULIP);
    flower.addType(Block.RED_FLOWER, BlockFlower.TYPE_WHITE_TULIP);
    flower.addType(Block.RED_FLOWER, BlockFlower.TYPE_PINK_TULIP);
    flower.addType(Block.RED_FLOWER, BlockFlower.TYPE_OXEYE_DAISY);

    this.addPopulator(sugarcane);
    this.addPopulator(tallSugarcane);
    this.addPopulator(grass);
    this.addPopulator(tallGrass);
    this.addPopulator(flower);


    this.setElevation(63, 74);

    this.temperature = 0.8;
    this.rainfall = 0.4;
}
 
Example #8
Source File: SwampBiome.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public SwampBiome() {
    super();

    PopulatorLilyPad lilypad = new PopulatorLilyPad();
    lilypad.setBaseAmount(4);
    lilypad.setRandomAmount(2);
    this.addPopulator(lilypad);

    SwampTreePopulator trees = new SwampTreePopulator();
    trees.setBaseAmount(2);
    this.addPopulator(trees);

    PopulatorFlower flower = new PopulatorFlower();
    flower.setBaseAmount(2);
    flower.addType(Block.RED_FLOWER, BlockFlower.TYPE_BLUE_ORCHID);
    this.addPopulator(flower);

    MushroomPopulator mushroom = new MushroomPopulator(1);
    mushroom.setBaseAmount(-5);
    mushroom.setRandomAmount(7);
    this.addPopulator(mushroom);

    PopulatorSmallMushroom smallMushroom = new PopulatorSmallMushroom();
    smallMushroom.setBaseAmount(0);
    smallMushroom.setRandomAmount(2);
    this.addPopulator(smallMushroom);

    this.setBaseHeight(-0.2f);
    this.setHeightVariation(0.1f);
}
 
Example #9
Source File: PlainBiome.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public PlainBiome() {
    super();
    PopulatorSugarcane sugarcane = new PopulatorSugarcane();
    sugarcane.setBaseAmount(6);
    PopulatorTallSugarcane tallSugarcane = new PopulatorTallSugarcane();
    tallSugarcane.setBaseAmount(60);
    PopulatorGrass grass = new PopulatorGrass();
    grass.setBaseAmount(40);
    PopulatorTallGrass tallGrass = new PopulatorTallGrass();
    tallGrass.setBaseAmount(7);
    PopulatorFlower flower = new PopulatorFlower();
    flower.setBaseAmount(10);
    flower.addType(Block.DANDELION, 0);
    flower.addType(Block.RED_FLOWER, BlockFlower.TYPE_POPPY);
    flower.addType(Block.RED_FLOWER, BlockFlower.TYPE_AZURE_BLUET);
    flower.addType(Block.RED_FLOWER, BlockFlower.TYPE_RED_TULIP);
    flower.addType(Block.RED_FLOWER, BlockFlower.TYPE_ORANGE_TULIP);
    flower.addType(Block.RED_FLOWER, BlockFlower.TYPE_WHITE_TULIP);
    flower.addType(Block.RED_FLOWER, BlockFlower.TYPE_PINK_TULIP);
    flower.addType(Block.RED_FLOWER, BlockFlower.TYPE_OXEYE_DAISY);

    this.addPopulator(sugarcane);
    this.addPopulator(tallSugarcane);
    this.addPopulator(grass);
    this.addPopulator(tallGrass);
    this.addPopulator(flower);


    this.setElevation(63, 74);

    this.temperature = 0.8;
    this.rainfall = 0.4;
}