Search in sources :

Example 1 with WorldGenFlowersBase

use of stevekung.mods.stevekunglib.world.gen.WorldGenFlowersBase in project MorePlanets by SteveKunG.

the class BiomeDecoratorChalos method generate.

@Override
protected void generate(Biome biome, World world, Random rand) {
    for (int i = 0; i < this.flowersPerChunk; ++i) {
        WorldDecorateUtils.generatePlants(new WorldGenFlowersBase(MPBlocks.CHEESE_SPORE_FLOWER.getDefaultState().withProperty(BlockSaplingMP.NATURAL_GEN, true)), world, rand, this.chunkPos);
    }
    for (int i = 0; i < this.grassPerChunk; ++i) {
        WorldDecorateUtils.generatePlants(new WorldGenFlowersBase(MPBlocks.CHEESE_GRASS.getDefaultState()), world, rand, this.chunkPos);
    }
    int chance = this.treesPerChunk;
    if (rand.nextFloat() < this.extraTreeChance) {
        ++chance;
    }
    for (int i = 0; i < chance; ++i) {
        WorldDecorateUtils.generateCustomTrees(new WorldGenCheeseSporeTree(6 + rand.nextInt(4), true), world, rand, biome, this.chunkPos);
    }
    chance = this.cheeseSporeStemPerChunk;
    if (rand.nextFloat() < this.extraStemChance) {
        ++chance;
    }
    for (int i = 0; i < chance; ++i) {
        WorldDecorateUtils.generateCustomTrees(new WorldGenCheeseSporeTree(6 + rand.nextInt(4), false), world, rand, biome, this.chunkPos);
    }
}
Also used : WorldGenCheeseSporeTree(stevekung.mods.moreplanets.planets.chalos.world.gen.feature.WorldGenCheeseSporeTree) WorldGenFlowersBase(stevekung.mods.stevekunglib.world.gen.WorldGenFlowersBase)

Example 2 with WorldGenFlowersBase

use of stevekung.mods.stevekunglib.world.gen.WorldGenFlowersBase in project MorePlanets by SteveKunG.

the class BiomeDecoratorFronos method generate.

@Override
protected void generate(Biome biome, World world, Random rand) {
    for (int i = 0; i < this.grassPerChunk; ++i) {
        WorldDecorateUtils.generatePlants(biome.getRandomWorldGenForGrass(rand), world, rand, this.chunkPos);
    }
    for (int i = 0; i < this.flowersPerChunk; ++i) {
        if (!(biome instanceof BiomeMP)) {
            return;
        }
        int x = rand.nextInt(16) + 8;
        int z = rand.nextInt(16) + 8;
        int y = world.getHeight(this.chunkPos.add(x, 0, z)).getY() + 32;
        if (y > 0) {
            int randY = rand.nextInt(y);
            BlockPos blockpos1 = this.chunkPos.add(x, randY, z);
            IBlockState state = ((BiomeMP) biome).pickRandomModdedFlower(rand, blockpos1);
            if (state.getMaterial() != Material.AIR) {
                WorldGenFlowersBase worldGen = new WorldGenFlowersBase(state);
                worldGen.generate(world, rand, blockpos1);
            }
        }
    }
    for (int i = 0; i < this.waterlilyPerChunk; ++i) {
        int x = rand.nextInt(16) + 8;
        int z = rand.nextInt(16) + 8;
        int y = world.getHeight(this.chunkPos.add(x, 0, z)).getY() * 2;
        if (y > 0) {
            int y1 = rand.nextInt(y);
            BlockPos blockpos4;
            BlockPos blockpos7;
            for (blockpos4 = this.chunkPos.add(x, y1, z); blockpos4.getY() > 0; blockpos4 = blockpos7) {
                blockpos7 = blockpos4.down();
                if (!world.isAirBlock(blockpos7)) {
                    break;
                }
            }
            new WorldGenFronosLilyPad().generate(world, rand, blockpos4);
        }
    }
    for (int i = 0; i < this.clayPerChunk; ++i) {
        int l1 = rand.nextInt(16) + 8;
        int i6 = rand.nextInt(16) + 8;
        new WorldGenFronosClay(4).generate(world, rand, world.getTopSolidOrLiquidBlock(this.chunkPos.add(l1, 0, i6)));
    }
    for (int i = 0; i < this.reedsPerChunk; ++i) {
        WorldDecorateUtils.generatePlants(new WorldGenFronosSugarCane(), world, rand, this.chunkPos);
    }
    for (int i = 0; i < this.sandPatchesPerChunk; ++i) {
        int j = rand.nextInt(16) + 8;
        int k = rand.nextInt(16) + 8;
        new WorldGenFronosSand(Blocks.SAND.getDefaultState(), 7).generate(world, rand, world.getTopSolidOrLiquidBlock(this.chunkPos.add(j, 0, k)));
    }
    for (int i = 0; i < this.gravelPatchesPerChunk; ++i) {
        int i2 = rand.nextInt(16) + 8;
        int j6 = rand.nextInt(16) + 8;
        new WorldGenFronosSand(Blocks.GRAVEL.getDefaultState(), 6).generate(world, rand, world.getTopSolidOrLiquidBlock(this.chunkPos.add(i2, 0, j6)));
    }
    int treesPerChunk = this.treesPerChunk;
    if (rand.nextFloat() < this.extraTreeChance) {
        ++treesPerChunk;
    }
    for (int i = 0; i < treesPerChunk; ++i) {
        int x = rand.nextInt(16) + 8;
        int z = rand.nextInt(16) + 8;
        BlockPos pos = world.getHeight(this.chunkPos.add(x, 0, z));
        WorldGenAbstractTree tree = biome.getRandomTreeFeature(rand);
        tree.setDecorationDefaults();
        if (tree.generate(world, rand, pos)) {
            tree.generateSaplings(world, rand, pos);
        }
    }
    if (this.largeWheatPerChunk > 0) {
        int wheatPerChunk = rand.nextInt(3) - this.largeWheatPerChunk;
        for (int i = 0; i < wheatPerChunk; ++i) {
            int y = rand.nextInt(world.getHeight(this.chunkPos.add(rand.nextInt(16) + 8, 0, rand.nextInt(16) + 8)).getY() + 32);
            WorldGenDoublePlantMP worldgen = new WorldGenDoublePlantMP(MPBlocks.LARGE_WHEAT);
            if (worldgen.generate(world, rand, new BlockPos(this.chunkPos.getX() + rand.nextInt(16) + 8, y, this.chunkPos.getZ() + rand.nextInt(16) + 8))) {
                break;
            }
        }
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) BiomeMP(stevekung.mods.moreplanets.utils.world.gen.biome.BiomeMP) WorldGenFronosLilyPad(stevekung.mods.moreplanets.planets.fronos.world.gen.feature.WorldGenFronosLilyPad) WorldGenFronosSand(stevekung.mods.moreplanets.planets.fronos.world.gen.feature.WorldGenFronosSand) WorldGenFronosSugarCane(stevekung.mods.moreplanets.planets.fronos.world.gen.feature.WorldGenFronosSugarCane) WorldGenAbstractTree(net.minecraft.world.gen.feature.WorldGenAbstractTree) BlockPos(net.minecraft.util.math.BlockPos) WorldGenDoublePlantMP(stevekung.mods.moreplanets.utils.world.gen.feature.WorldGenDoublePlantMP) WorldGenFronosClay(stevekung.mods.moreplanets.planets.fronos.world.gen.feature.WorldGenFronosClay) WorldGenFlowersBase(stevekung.mods.stevekunglib.world.gen.WorldGenFlowersBase)

Example 3 with WorldGenFlowersBase

use of stevekung.mods.stevekunglib.world.gen.WorldGenFlowersBase in project MorePlanets by SteveKunG.

the class BiomeDecoratorNibiru method generate.

@Override
protected void generate(Biome biome, World world, Random rand) {
    for (int i = 0; i < this.grassPerChunk; ++i) {
        WorldDecorateUtils.generatePlants(biome.getRandomWorldGenForGrass(rand), world, rand, this.chunkPos);
    }
    for (int i = 0; i < this.flowersPerChunk; ++i) {
        if (!(biome instanceof BiomeMP)) {
            return;
        }
        int x = rand.nextInt(16) + 8;
        int z = rand.nextInt(16) + 8;
        int y = world.getHeight(this.chunkPos.add(x, 0, z)).getY() + 32;
        if (y > 0) {
            int randY = rand.nextInt(y);
            BlockPos blockpos1 = this.chunkPos.add(x, randY, z);
            IBlockState state = ((BiomeMP) biome).pickRandomModdedFlower(rand, blockpos1);
            if (state.getMaterial() != Material.AIR) {
                WorldGenFlowersBase worldGen = new WorldGenFlowersBase(state);
                worldGen.generate(world, rand, blockpos1);
            }
        }
    }
    for (int i = 0; i < this.cactiPerChunk; ++i) {
        WorldDecorateUtils.generatePlants(new WorldGenInfectedCactus(), world, rand, this.chunkPos);
    }
    for (int i = 0; i < this.deadBushPerChunk; ++i) {
        WorldDecorateUtils.generatePlants(new WorldGenDeadBush(), world, rand, this.chunkPos);
    }
    for (int i = 0; i < this.waterlilyPerChunk; ++i) {
        int x = rand.nextInt(16) + 8;
        int z = rand.nextInt(16) + 8;
        int y = world.getHeight(this.chunkPos.add(x, 0, z)).getY() * 2;
        if (y > 0) {
            int y1 = rand.nextInt(y);
            BlockPos blockpos4;
            BlockPos blockpos7;
            for (blockpos4 = this.chunkPos.add(x, y1, z); blockpos4.getY() > 0; blockpos4 = blockpos7) {
                blockpos7 = blockpos4.down();
                if (!world.isAirBlock(blockpos7)) {
                    break;
                }
            }
            new WorldGenSporelily().generate(world, rand, blockpos4);
        }
    }
    for (int i = 0; i < this.clayPerChunk; ++i) {
        int l1 = rand.nextInt(16) + 8;
        int i6 = rand.nextInt(16) + 8;
        new WorldGenNibiruClay(4).generate(world, rand, world.getTopSolidOrLiquidBlock(this.chunkPos.add(l1, 0, i6)));
    }
    for (int i = 0; i < this.reedsPerChunk; ++i) {
        WorldDecorateUtils.generatePlants(new WorldGenInfectedSugarCane(), world, rand, this.chunkPos);
    }
    for (int i = 0; i < this.sandPatchesPerChunk; ++i) {
        int j = rand.nextInt(16) + 8;
        int k = rand.nextInt(16) + 8;
        new WorldGenNibiruSand(MPBlocks.INFECTED_SAND.getDefaultState(), 7).generate(world, rand, world.getTopSolidOrLiquidBlock(this.chunkPos.add(j, 0, k)));
    }
    for (int i = 0; i < this.gravelPatchesPerChunk; ++i) {
        int i2 = rand.nextInt(16) + 8;
        int j6 = rand.nextInt(16) + 8;
        new WorldGenNibiruSand(MPBlocks.INFECTED_GRAVEL.getDefaultState(), 6).generate(world, rand, world.getTopSolidOrLiquidBlock(this.chunkPos.add(i2, 0, j6)));
    }
    int treesPerChunk = this.treesPerChunk;
    if (rand.nextFloat() < this.extraTreeChance) {
        ++treesPerChunk;
    }
    for (int i = 0; i < treesPerChunk; ++i) {
        int x = rand.nextInt(16) + 8;
        int z = rand.nextInt(16) + 8;
        BlockPos pos = world.getHeight(this.chunkPos.add(x, 0, z));
        WorldGenAbstractTree tree = biome.getRandomTreeFeature(rand);
        tree.setDecorationDefaults();
        if (tree.generate(world, rand, pos)) {
            tree.generateSaplings(world, rand, pos);
        }
    }
    if (rand.nextInt(1000) == 0) {
        int x = rand.nextInt(16) + 8;
        int z = rand.nextInt(16) + 8;
        new WorldGenCrystalObelisk().generate(world, rand, world.getTopSolidOrLiquidBlock(this.chunkPos.add(x, 0, z)));
    }
    if (this.orangeBushPerChunk > 0) {
        int roseBushPerChunk = rand.nextInt(5) - this.orangeBushPerChunk;
        for (int i = 0; i < roseBushPerChunk; ++i) {
            for (int i2 = 0; i2 < 5; ++i2) {
                int y = rand.nextInt(world.getHeight(this.chunkPos.add(rand.nextInt(16) + 8, 0, rand.nextInt(16) + 8)).getY() + 32);
                WorldGenDoublePlantMP worldgen = new WorldGenDoublePlantMP(MPBlocks.INFECTED_ORANGE_ROSE_BUSH);
                if (worldgen.generate(world, rand, new BlockPos(this.chunkPos.getX() + rand.nextInt(16) + 8, y, this.chunkPos.getZ() + rand.nextInt(16) + 8))) {
                    break;
                }
            }
        }
    }
    for (int i = 0; i < 4; i++) {
        new WorldGenMultalicCrystal().generate(world, rand, this.chunkPos.add(rand.nextInt(16) + 8, rand.nextInt(36), rand.nextInt(16) + 8));
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) WorldGenDoublePlantMP(stevekung.mods.moreplanets.utils.world.gen.feature.WorldGenDoublePlantMP) WorldGenFlowersBase(stevekung.mods.stevekunglib.world.gen.WorldGenFlowersBase) BiomeMP(stevekung.mods.moreplanets.utils.world.gen.biome.BiomeMP) WorldGenDeadBush(net.minecraft.world.gen.feature.WorldGenDeadBush) WorldGenAbstractTree(net.minecraft.world.gen.feature.WorldGenAbstractTree) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

WorldGenFlowersBase (stevekung.mods.stevekunglib.world.gen.WorldGenFlowersBase)3 IBlockState (net.minecraft.block.state.IBlockState)2 BlockPos (net.minecraft.util.math.BlockPos)2 WorldGenAbstractTree (net.minecraft.world.gen.feature.WorldGenAbstractTree)2 BiomeMP (stevekung.mods.moreplanets.utils.world.gen.biome.BiomeMP)2 WorldGenDoublePlantMP (stevekung.mods.moreplanets.utils.world.gen.feature.WorldGenDoublePlantMP)2 WorldGenDeadBush (net.minecraft.world.gen.feature.WorldGenDeadBush)1 WorldGenCheeseSporeTree (stevekung.mods.moreplanets.planets.chalos.world.gen.feature.WorldGenCheeseSporeTree)1 WorldGenFronosClay (stevekung.mods.moreplanets.planets.fronos.world.gen.feature.WorldGenFronosClay)1 WorldGenFronosLilyPad (stevekung.mods.moreplanets.planets.fronos.world.gen.feature.WorldGenFronosLilyPad)1 WorldGenFronosSand (stevekung.mods.moreplanets.planets.fronos.world.gen.feature.WorldGenFronosSand)1 WorldGenFronosSugarCane (stevekung.mods.moreplanets.planets.fronos.world.gen.feature.WorldGenFronosSugarCane)1