net.minecraft.world.gen.feature.WorldGenerator Java Examples

The following examples show how to use net.minecraft.world.gen.feature.WorldGenerator. 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: BiomeTofuForest.java    From TofuCraftReload with MIT License 6 votes vote down vote up
@Override
public void decorate(World worldIn, Random rand, BlockPos pos) {
    super.decorate(worldIn, rand, pos);
    int j, k, l, i1;

    if (rand.nextInt(30) == 0) {
        BlockPos.MutableBlockPos mutable = new BlockPos.MutableBlockPos();

        for (j = 0; j < 5; j++) {
            k = pos.getX() + rand.nextInt(16) + 8;
            l = rand.nextInt(128);
            i1 = pos.getZ() + rand.nextInt(16) + 8;
            mutable.setPos(k, l, i1);

            WorldGenerator var6 = new WorldGenBush(BlockLoader.TOFUFLOWER);
            var6.generate(worldIn, rand, mutable);
        }
    }
}
 
Example #2
Source File: BlockMapleSaplingGreen.java    From Sakura_mod with MIT License 6 votes vote down vote up
@Override
public void grow(World world, Random rand, BlockPos pos, IBlockState state) {
	WorldGenerator treeGenerator = rand.nextInt(8) == 0
			? new WorldGenMapleTreeGreen(true, 5, BlockLoader.MAPLE_LOG.getDefaultState(),
					BlockLoader.MAPLE_LEAVE_GREEN.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false)
							.withProperty(BlockLeaves.DECAYABLE, true),
					BlockLoader.FALLEN_LEAVES_MAPLE_GREEN.getDefaultState(), true)
			: new WorldGenMapleTreeGreen(true, 5, BlockLoader.MAPLE_LOG.getDefaultState(),
					BlockLoader.MAPLE_LEAVE_GREEN.getDefaultState()
							.withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
					BlockLoader.FALLEN_LEAVES_MAPLE_GREEN.getDefaultState(), false);

	world.setBlockState(pos, Blocks.AIR.getDefaultState(), 4);

	if (!treeGenerator.generate(world, rand, pos)) {

		world.setBlockState(pos, state, 4);

	}
}
 
Example #3
Source File: ForgeEventHandler.java    From GardenCollection with MIT License 6 votes vote down vote up
@SubscribeEvent
public void applyEnrichedSoil (EnrichedSoilEvent event) {
    if (!GardenTrees.config.compostGrowsOrnamentalTrees)
        return;

    Item sapling = Item.getItemFromBlock(event.block);
    int saplingMeta = event.world.getBlockMetadata(event.x, event.y, event.z);
    if (sapling == null)
        return;

    WorldGenerator generator = (WorldGenerator) SaplingRegistry.instance().getExtendedData(sapling, saplingMeta, "sm_generator");
    if (generator == null)
        return;

    event.world.setBlockToAir(event.x, event.y, event.z);

    if (generator.generate(event.world, event.world.rand, event.x, event.y, event.z)) {
        event.setResult(Event.Result.ALLOW);
        return;
    }

    event.world.setBlock(event.x, event.y, event.z, event.block, saplingMeta, 0);
}
 
Example #4
Source File: GardenCoreIntegration.java    From GardenCollection with MIT License 6 votes vote down vote up
@Override
public boolean applyBonemeal (World world, int x, int y, int z, BlockGarden hostBlock, int slot) {
    Block plantBlock = hostBlock.getPlantBlockFromSlot(world, x, y, z, slot);
    if (plantBlock == null)
        return false;

    Item sapling = Item.getItemFromBlock(plantBlock);
    int saplingMeta = hostBlock.getPlantMetaFromSlot(world, x, y, z, slot);

    WorldGenerator generator = (WorldGenerator) SaplingRegistry.instance().getExtendedData(sapling, saplingMeta, "sm_generator");
    if (generator == null)
        return false;

    NBTTagCompound storedTE = hostBlock.saveAndClearPlantedContents(world, x, y, z);

    if (!generator.generate(world, world.rand, x, y + 1, z))
        hostBlock.restorePlantedContents(world, x, y, z, storedTE);

    return true;
}
 
Example #5
Source File: BlockAlienSapling.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
public void generateTree(World world, BlockPos pos, IBlockState state,
		Random random) {
    if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(world, random, pos)) 
    	return;
    
    IBlockState l = this.getDefaultState();//world.getBlockState(pos);//world.getBlockMetadata(x, y, z) & 7;
    Object object = new WorldGenAlienTree(true);
    int i1 = 0;
    int j1 = 0;

    if (!((WorldGenerator)object).generate(world, random, pos.add(i1, 0, j1)))
    {
        
        world.setBlockState(pos, l, 4);
        
    }
}
 
Example #6
Source File: BiomeGenWyvernLair.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
/**
    * Gets a WorldGen appropriate for this biome.
    */
@Override
   public WorldGenerator getRandomWorldGenForGrass(Random par1Random)
   {
   	//System.out.println("grass rnd called");
       //return par1Random.nextInt(4) == 0 ? new WorldGenWyvernGrass(Block.tallGrass.blockID, 2) : new WorldGenWyvernGrass(Block.tallGrass.blockID, 1);
   	return new WorldGenWyvernGrass(MoCreatures.mocTallGrass.blockID, 0);
   }
 
Example #7
Source File: BlockTofuSapling.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@Override
public void grow(World world, Random rand, BlockPos pos, IBlockState state) {
    WorldGenerator treeGenerator = new WorldGenTofuTrees(true);
    world.setBlockState(pos, Blocks.AIR.getDefaultState(), 4);
    if (!treeGenerator.generate(world, rand, pos)) {
        world.setBlockState(pos, state, 4);
    }
}
 
Example #8
Source File: BiomeGenWyvernLair.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
/**
    * Gets a WorldGen appropriate for this biome.
    */
@Override
   public WorldGenerator getRandomWorldGenForTrees(Random par1Random)
   {
       //return (WorldGenerator)(par1Random.nextInt(10) == 0 ? this.worldGeneratorBigTree : (par1Random.nextInt(2) == 0 ? new WorldGenShrub(3, 0) : (par1Random.nextInt(3) == 0 ? new WorldGenHugeTrees(false, 10 + par1Random.nextInt(20), 3, 3) : new WorldGenTrees(false, 4 + par1Random.nextInt(7), 3, 3, true))));
       
      // return (WorldGenerator)(par1Random.nextInt(10) == 0 ? this.worldGeneratorBigTree : (par1Random.nextInt(2) == 0 ? new WorldGenShrub(3, 0) : (par1Random.nextInt(3) == 0 ? new WorldGenWyvernTrees(false) : new WorldGenTrees(false, 4 + par1Random.nextInt(7), 3, 3, true))));
       //return (WorldGenerator) (par1Random.nextInt(10) == 0 ? new MoCWorldGenBigTree(false, MoCreatures.mocLog.blockID, 0, MoCreatures.mocLeaf.blockID, 0, 2, 30, 10) : this.worldGeneratorBigTree );
       return (WorldGenerator) (par1Random.nextInt(10) == 0 ? new MoCWorldGenBigTree(false, MoCreatures.mocLog.blockID, 0, MoCreatures.mocLeaf.blockID, 0, 2, 30, 10) : new WorldGenShrub(3, 0) );
       
   }
 
Example #9
Source File: BlockSakuraSapling.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Override
public void grow(World world, Random rand, BlockPos pos, IBlockState state) {
	WorldGenerator treeGenerator = rand.nextInt(8) == 0 ? new WorldGenSakuraTree(true, 5)
			: new WorldGenBigSakura(true);

	world.setBlockState(pos, Blocks.AIR.getDefaultState(), 4);
	if (!treeGenerator.generate(world, rand, pos))
		world.setBlockState(pos, state, 4);
}
 
Example #10
Source File: BlockGTSapling.java    From GardenCollection with MIT License 5 votes vote down vote up
@Override
public void func_149878_d (World world, int x, int y, int z, Random random) {
    if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(world, random, x, y, z))
        return;

    int id = world.getBlockMetadata(x, y, z) & 7;
    WorldGenerator generator = null;

    switch (id) {
        case 0:
            generator = new WorldGenTaiga1() {
                @Override
                protected void setBlockAndNotifyAdequately (World world, int x, int y, int z, Block block, int meta) {
                    world.setBlock(x, y, z, block, meta, 3);
                }
            };
            break;
        case 1:
            generator = new WorldGenSwamp() {
                @Override
                protected void setBlockAndNotifyAdequately (World world, int x, int y, int z, Block block, int meta) {
                    world.setBlock(x, y, z, block, meta, 3);
                }
            };
            break;
        case 2:
            generator = new WorldGenForest(true, true);
            break;
        default:
            return;
    }

    world.setBlock(x, y, z, Blocks.air, 0, 4);

    if (!(generator.generate(world, random, x, y, z)))
        world.setBlock(x, y, z, this, id, 4);
}
 
Example #11
Source File: BiomeRockyPlains.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void genStandardOre2(World worldIn, Random random, int blockCount, WorldGenerator generator, int centerHeight, int spread) {
	for (int i = 0; i < blockCount; ++i)
	{
		BlockPos blockpos = this.chunkPos.add(random.nextInt(16), random.nextInt(spread) + random.nextInt(spread) + centerHeight - spread, random.nextInt(16));
		generator.generate(worldIn, random, blockpos);
	}
}
 
Example #12
Source File: ValkyrienSkiesWorldGen.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
private void runValkyriumGenerator(WorldGenerator generator, World world, Random rand,
    int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight) {
    if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight) {
        throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator");
    }

    int heightDiff = maxHeight - minHeight + 1;
    for (int i = 0; i < chancesToSpawn; i++) {
        int x = chunk_X * 16 + rand.nextInt(16);
        int y = minHeight + rand.nextInt(heightDiff);
        int z = chunk_Z * 16 + rand.nextInt(16);
        generator.generate(world, rand, new BlockPos(x, y, z));
    }
}
 
Example #13
Source File: BiomeRockyPlains.java    From Traverse-Legacy-1-12-2 with MIT License 5 votes vote down vote up
@Override
protected void genStandardOre2(World worldIn, Random random, int blockCount, WorldGenerator generator, int centerHeight, int spread) {
	for (int i = 0; i < blockCount; ++i)
	{
		BlockPos blockpos = this.chunkPos.add(random.nextInt(16), random.nextInt(spread) + random.nextInt(spread) + centerHeight - spread, random.nextInt(16));
		generator.generate(worldIn, random, blockpos);
	}
}
 
Example #14
Source File: WorldGenTofuBuilding.java    From TofuCraftReload with MIT License 4 votes vote down vote up
protected void plantLeeks(BlockPos pos, int r, World world, Random random)
{
    WorldGenerator var6 = new WorldGenBush(BlockLoader.LEEK);
    var6.generate(world, random, pos);
}
 
Example #15
Source File: BiomeCragCliffs.java    From Traverse-Legacy-1-12-2 with MIT License 4 votes vote down vote up
@Override
public WorldGenerator getRandomWorldGenForGrass(Random rand) {
	return COLD_GRASS_FEATURE;
}
 
Example #16
Source File: BiomeCanyon.java    From Traverse-Legacy-1-12-2 with MIT License 4 votes vote down vote up
@Override
public WorldGenerator getRandomWorldGenForGrass(Random rand) {
	return DEAD_GRASS_FEATURE;
}
 
Example #17
Source File: BiomeRockyPlains.java    From Traverse-Legacy-1-12-2 with MIT License 4 votes vote down vote up
@Override
protected void genStandardOre1(World worldIn, Random random, int blockCount, WorldGenerator generator, int minHeight, int maxHeight) {
	super.genStandardOre1(worldIn, random, blockCount, generator, minHeight, maxHeight);
}
 
Example #18
Source File: BiomeCragCliffs.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public WorldGenerator getRandomWorldGenForGrass(Random rand) {
	return COLD_GRASS_FEATURE;
}
 
Example #19
Source File: BiomeCanyon.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public WorldGenerator getRandomWorldGenForGrass(Random rand) {
	return DEAD_GRASS_FEATURE;
}
 
Example #20
Source File: BiomeRockyPlains.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
protected void genStandardOre1(World worldIn, Random random, int blockCount, WorldGenerator generator, int minHeight, int maxHeight) {
	super.genStandardOre1(worldIn, random, blockCount, generator, minHeight, maxHeight);
}
 
Example #21
Source File: BlockMapleSaplingOrange.java    From Sakura_mod with MIT License 4 votes vote down vote up
@Override
public void grow(World world, Random rand, BlockPos pos, IBlockState state) {
	WorldGenerator treeGenerator = new WorldGenMapleTree(true, 5, BlockLoader.MAPLE_LOG.getDefaultState(),
			BlockLoader.MAPLE_LEAVE_ORANGE.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
			BlockLoader.FALLEN_LEAVES_MAPLE_ORANGE.getDefaultState(), false);
	switch (rand.nextInt(16)) {
	case 0:
		treeGenerator = new WorldGenBigMaple(true, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_SAPLING_ORANGE.getDefaultState(),
				BlockLoader.MAPLE_LEAVE_ORANGE.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
				BlockLoader.FALLEN_LEAVES_MAPLE_ORANGE.getDefaultState(), true);
		break;
	case 1:
		treeGenerator = new WorldGenBigMaple(true, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_SAPLING_ORANGE.getDefaultState(),
				BlockLoader.MAPLE_LEAVE_ORANGE.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
				BlockLoader.FALLEN_LEAVES_MAPLE_ORANGE.getDefaultState(), false);
		break;
	case 2:
		treeGenerator = new WorldGenBigMaple(true, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_SAPLING_ORANGE.getDefaultState(),
				BlockLoader.MAPLE_LEAVE_ORANGE.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
				BlockLoader.FALLEN_LEAVES_MAPLE_ORANGE.getDefaultState(), false);
		break;
	case 3:
		treeGenerator = new WorldGenMapleTree(true, 5, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_LEAVE_ORANGE.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
				BlockLoader.FALLEN_LEAVES_MAPLE_ORANGE.getDefaultState(), true);
		break;
	case 4:
		treeGenerator = new WorldGenMapleTree(true, 5, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_LEAVE_ORANGE.getDefaultState(),
				BlockLoader.FALLEN_LEAVES_MAPLE_ORANGE.getDefaultState(), true);
		break;
	case 5:
		treeGenerator = new WorldGenMapleTree(true, 5, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_LEAVE_ORANGE.getDefaultState(),
				BlockLoader.FALLEN_LEAVES_MAPLE_ORANGE.getDefaultState(), true);
		break;
	default:
		break;
	}
	world.setBlockState(pos, Blocks.AIR.getDefaultState(), 4);
	if (!treeGenerator.generate(world, rand, pos)) {
		world.setBlockState(pos, state, 4);
	}
}
 
Example #22
Source File: BlockMapleSaplingRed.java    From Sakura_mod with MIT License 4 votes vote down vote up
@Override
public void grow(World world, Random rand, BlockPos pos, IBlockState state) {
	WorldGenerator treeGenerator = new WorldGenMapleTree(true, 5, BlockLoader.MAPLE_LOG.getDefaultState(),
			BlockLoader.MAPLE_LEAVE_RED.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true), BlockLoader.FALLEN_LEAVES_MAPLE_RED.getDefaultState(),
			false);
	switch (rand.nextInt(16)) {
	case 0:
		treeGenerator = new WorldGenBigMaple(true, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_SAPLING_RED.getDefaultState(), BlockLoader.MAPLE_LEAVE_RED.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
				BlockLoader.FALLEN_LEAVES_MAPLE_RED.getDefaultState(), true);
		break;
	case 1:
		treeGenerator = new WorldGenBigMaple(true, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_SAPLING_RED.getDefaultState(), BlockLoader.MAPLE_LEAVE_RED.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
				BlockLoader.FALLEN_LEAVES_MAPLE_RED.getDefaultState(), false);
		break;
	case 2:
		treeGenerator = new WorldGenBigMaple(true, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_SAPLING_RED.getDefaultState(), BlockLoader.MAPLE_LEAVE_RED.getDefaultState(),
				BlockLoader.FALLEN_LEAVES_MAPLE_RED.getDefaultState(), false);
		break;
	case 3:
		treeGenerator = new WorldGenMapleTree(true, 5, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_LEAVE_RED.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
				BlockLoader.FALLEN_LEAVES_MAPLE_RED.getDefaultState(), true);
		break;
	case 4:
		treeGenerator = new WorldGenMapleTree(true, 5, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_LEAVE_RED.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
				BlockLoader.FALLEN_LEAVES_MAPLE_RED.getDefaultState(), true);
		break;
	case 5:
		treeGenerator = new WorldGenMapleTree(true, 5, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_LEAVE_RED.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
				BlockLoader.FALLEN_LEAVES_MAPLE_RED.getDefaultState(), true);
		break;
	default:
		break;
	}
	world.setBlockState(pos, Blocks.AIR.getDefaultState(), 4);
	if (!treeGenerator.generate(world, rand, pos)) {
		world.setBlockState(pos, state, 4);
	}
}
 
Example #23
Source File: BlockMapleSaplingYellow.java    From Sakura_mod with MIT License 4 votes vote down vote up
@Override
public void grow(World world, Random rand, BlockPos pos, IBlockState state) {
	WorldGenerator treeGenerator = new WorldGenMapleTree(true, 5, BlockLoader.MAPLE_LOG.getDefaultState(),
			BlockLoader.MAPLE_LEAVE_YELLOW.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
			BlockLoader.FALLEN_LEAVES_MAPLE_YELLOW.getDefaultState(), false);
	switch (rand.nextInt(16)) {
	case 0:
		treeGenerator = new WorldGenBigMaple(true, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_SAPLING_YELLOW.getDefaultState(),
				BlockLoader.MAPLE_LEAVE_YELLOW.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
				BlockLoader.FALLEN_LEAVES_MAPLE_YELLOW.getDefaultState(), true);
		break;
	case 1:
		treeGenerator = new WorldGenBigMaple(true, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_SAPLING_YELLOW.getDefaultState(),
				BlockLoader.MAPLE_LEAVE_YELLOW.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
				BlockLoader.FALLEN_LEAVES_MAPLE_YELLOW.getDefaultState(), false);
		break;
	case 2:
		treeGenerator = new WorldGenBigMaple(true, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_SAPLING_YELLOW.getDefaultState(),
				BlockLoader.MAPLE_LEAVE_YELLOW.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
				BlockLoader.FALLEN_LEAVES_MAPLE_YELLOW.getDefaultState(), false);
		break;
	case 3:
		treeGenerator = new WorldGenMapleTree(true, 5, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_LEAVE_YELLOW.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
				BlockLoader.FALLEN_LEAVES_MAPLE_YELLOW.getDefaultState(), true);
		break;
	case 4:
		treeGenerator = new WorldGenMapleTree(true, 5, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_LEAVE_YELLOW.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
				BlockLoader.FALLEN_LEAVES_MAPLE_YELLOW.getDefaultState(), true);
		break;
	case 5:
		treeGenerator = new WorldGenMapleTree(true, 5, BlockLoader.MAPLE_LOG.getDefaultState(),
				BlockLoader.MAPLE_LEAVE_YELLOW.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockLeaves.DECAYABLE, true),
				BlockLoader.FALLEN_LEAVES_MAPLE_YELLOW.getDefaultState(), true);
		break;
	default:
		break;
	}
	world.setBlockState(pos, Blocks.AIR.getDefaultState(), 4);
	if (!treeGenerator.generate(world, rand, pos)) {
		world.setBlockState(pos, state, 4);
	}
}
 
Example #24
Source File: BiomeBambooForest.java    From Sakura_mod with MIT License 4 votes vote down vote up
public WorldGenerator getRandomWorldGenForGrass(Random rand)
{
    return rand.nextInt(4) == 0 ? new WorldGenTallGrass(BlockTallGrass.EnumType.FERN) : new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS);
}
 
Example #25
Source File: BlockApricotSapling.java    From TofuCraftReload with MIT License 3 votes vote down vote up
@Override
public void grow(World world, Random rand, BlockPos pos, IBlockState state) {
    WorldGenerator treeGenerator = new WorldGenApricotTrees(true);

    world.setBlockState(pos, Blocks.AIR.getDefaultState(), 4);

    if (!treeGenerator.generate(world, rand, pos)) {

        world.setBlockState(pos, state, 4);

    }
}
 
Example #26
Source File: IWorldGenInterface.java    From PneumaticCraft with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Retrieves generators for trees identified by a given string.
 * 
 * Returned generator classes take an {@link ITreeGenData} in the constructor.
 * 
 * @param ident
 *            Unique identifier for tree type. Forestry's convention is 'treeSpecies', i.e. 'treeBaobab', 'treeSequoia'.
 * @return All generators matching the given ident.
 */
Class<? extends WorldGenerator>[] getTreeGenerators(String ident);
 
Example #27
Source File: IAlleleTreeSpecies.java    From PneumaticCraft with GNU General Public License v3.0 2 votes vote down vote up
/**
 * @param tree
 * @param world
 * @param x
 * @param y
 * @param z
 * @return Tree generator for the tree at the given location.
 */
WorldGenerator getGenerator(ITree tree, World world, int x, int y, int z);
 
Example #28
Source File: IAlleleTreeSpecies.java    From PneumaticCraft with GNU General Public License v3.0 2 votes vote down vote up
/**
 * @return All available generator classes for this species.
 */
Class<? extends WorldGenerator>[] getGeneratorClasses();
 
Example #29
Source File: ITree.java    From PneumaticCraft with GNU General Public License v3.0 votes vote down vote up
WorldGenerator getTreeGenerator(World world, int x, int y, int z, boolean wasBonemealed);