Search in sources :

Example 6 with WorldGenAbstractTree

use of net.minecraft.world.gen.feature.WorldGenAbstractTree 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 7 with WorldGenAbstractTree

use of net.minecraft.world.gen.feature.WorldGenAbstractTree in project Gaia-Dimension by Andromander.

the class GDBiomeDecorator method decorate.

public void decorate(World world, Random rand, Biome biome, BlockPos pos) {
    this.chunkProviderSettings = ChunkGeneratorSettings.Factory.jsonToFactory(world.getWorldInfo().getGeneratorOptions()).build();
    this.chunkPos = pos;
    this.gaiaBiome = (GDBiomeBase) biome;
    genLakes(world, rand);
    for (int i = 0; i < treesPerChunk; ++i) {
        int k6 = rand.nextInt(16) + 8;
        int l = rand.nextInt(16) + 8;
        WorldGenAbstractTree worldgenabstracttree = biome.getRandomTreeFeature(rand);
        worldgenabstracttree.setDecorationDefaults();
        BlockPos blockpos = world.getHeight(this.chunkPos.add(k6, 0, l));
        if (worldgenabstracttree.generate(world, rand, blockpos)) {
            worldgenabstracttree.generateSaplings(world, rand, blockpos);
        }
    }
    for (int i = 0; i < this.grassPerChunk; ++i) {
        int x = rand.nextInt(16) + 8;
        int z = rand.nextInt(16) + 8;
        int height = world.getHeight(this.chunkPos.add(x, 0, z)).getY() * 2;
        if (height > 0) {
            int y = rand.nextInt(height);
            biome.getRandomWorldGenForGrass(rand).generate(world, rand, this.chunkPos.add(x, y, z));
        }
    }
    for (int i = 0; i < fungiPerChunk; ++i) {
        if (rand.nextInt(8) == 0) {
            int x = rand.nextInt(16) + 8;
            int z = rand.nextInt(16) + 8;
            int height = world.getHeight(this.chunkPos.add(x, 0, z)).getY() + 32;
            if (height > 0) {
                int y = rand.nextInt(height);
                BlockPos blockpos1 = this.chunkPos.add(x, y, z);
                gaiaBiome.getRandomFungus(rand).generate(world, rand, blockpos1);
            }
        }
    }
    for (int i = 0; i < flowersPerChunk; ++i) {
        if (rand.nextInt(4) == 0) {
            int x = rand.nextInt(16) + 8;
            int z = rand.nextInt(16) + 8;
            int height = world.getHeight(this.chunkPos.add(x, 0, z)).getY() + 32;
            if (height > 0) {
                int y = rand.nextInt(height);
                BlockPos blockpos1 = this.chunkPos.add(x, y, z);
                gaiaBiome.getRandomBloom(rand).generate(world, rand, blockpos1);
            }
        }
    }
    decorateUnderground(world, rand, pos);
}
Also used : WorldGenAbstractTree(net.minecraft.world.gen.feature.WorldGenAbstractTree) BlockPos(net.minecraft.util.math.BlockPos)

Example 8 with WorldGenAbstractTree

use of net.minecraft.world.gen.feature.WorldGenAbstractTree in project MorePlanets by SteveKunG.

the class BiomeInfectedForest method decorate.

@Override
public void decorate(World world, Random rand, BlockPos pos) {
    super.decorate(world, rand, pos);
    if (rand.nextInt(25) == 0) {
        BiomeNibiru.SCATTERED_DIRT.generate(world, rand, WorldDecorateUtils.getSimplePos(world, pos, rand));
    }
    if (this.type == Type.DARK) {
        WorldGenAbstractTree tree = this.getRandomTreeFeature(rand);
        tree.setDecorationDefaults();
        if (tree.generate(world, rand, pos)) {
            tree.generateSaplings(world, rand, pos);
        }
    }
}
Also used : WorldGenAbstractTree(net.minecraft.world.gen.feature.WorldGenAbstractTree)

Example 9 with WorldGenAbstractTree

use of net.minecraft.world.gen.feature.WorldGenAbstractTree 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)

Example 10 with WorldGenAbstractTree

use of net.minecraft.world.gen.feature.WorldGenAbstractTree in project Almura by AlmuraDev.

the class SaplingBlockImpl method generateTree.

@Override
public void generateTree(final World world, final BlockPos pos, final IBlockState state, final Random random) {
    if (!TerrainGen.saplingGrowTree(world, random, pos)) {
        return;
    }
    world.setBlockState(pos, Blocks.AIR.getDefaultState(), BlockUpdateFlag.PREVENT_RENDER);
    final WorldGenAbstractTree feature = this.tree(world.getBiome(pos), random);
    if (!feature.generate(world, random, pos)) {
        world.setBlockState(pos, state, BlockUpdateFlag.PREVENT_RENDER);
    }
}
Also used : WorldGenAbstractTree(net.minecraft.world.gen.feature.WorldGenAbstractTree)

Aggregations

WorldGenAbstractTree (net.minecraft.world.gen.feature.WorldGenAbstractTree)12 BlockPos (net.minecraft.util.math.BlockPos)9 TakumiWorldGenBigTree (com.tntmodders.takumi.world.gen.TakumiWorldGenBigTree)2 TakumiWorldGenTrees (com.tntmodders.takumi.world.gen.TakumiWorldGenTrees)2 IBlockState (net.minecraft.block.state.IBlockState)2 WorldGenDeadBush (net.minecraft.world.gen.feature.WorldGenDeadBush)2 BiomeMP (stevekung.mods.moreplanets.utils.world.gen.biome.BiomeMP)2 WorldGenDoublePlantMP (stevekung.mods.moreplanets.utils.world.gen.feature.WorldGenDoublePlantMP)2 WorldGenFlowersBase (stevekung.mods.stevekunglib.world.gen.WorldGenFlowersBase)2 WorldGenBirchTreePerverted (cavern.world.gen.WorldGenBirchTreePerverted)1 WorldGenSpruceTreePerverted (cavern.world.gen.WorldGenSpruceTreePerverted)1 WorldGenTreesPerverted (cavern.world.gen.WorldGenTreesPerverted)1 Calendar (java.util.Calendar)1 Biome (net.minecraft.world.biome.Biome)1 BiomeDecorator (net.minecraft.world.biome.BiomeDecorator)1 WorldGenDesertWells (net.minecraft.world.gen.feature.WorldGenDesertWells)1 WorldGenFossils (net.minecraft.world.gen.feature.WorldGenFossils)1 DecorateBiomeEvent (net.minecraftforge.event.terraingen.DecorateBiomeEvent)1 OreGenEvent (net.minecraftforge.event.terraingen.OreGenEvent)1 WorldGenInfectedVinesDirt (stevekung.mods.moreplanets.module.planets.nibiru.world.gen.feature.WorldGenInfectedVinesDirt)1