當前位置: 首頁>>代碼示例>>Java>>正文


Java TerrainGen.saplingGrowTree方法代碼示例

本文整理匯總了Java中net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree方法的典型用法代碼示例。如果您正苦於以下問題:Java TerrainGen.saplingGrowTree方法的具體用法?Java TerrainGen.saplingGrowTree怎麽用?Java TerrainGen.saplingGrowTree使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.event.terraingen.TerrainGen的用法示例。


在下文中一共展示了TerrainGen.saplingGrowTree方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: growTree

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
/**
 * Attempts to grow a sapling into a tree
 */
public void growTree(World world, int x, int y, int z, Random rand)
{
    if (!TerrainGen.saplingGrowTree(world, rand, x, y, z)) return;

    int l = world.getBlockMetadata(x, y, z) & 3;
    Object object = null;
    int i1 = 0;
    int j1 = 0;
    boolean flag = false;

    if (l == 1)
    {
        object = new WorldGenEbony(true);
    }
    else
    {
        object = new WorldGenIronbarkTree(true);
    }
    world.setBlock(x, y, z, 0, 0, 4);

    if (!((WorldGenerator)object).generate(world, rand, x + i1, y, z + j1))
    {
            world.setBlock(x, y, z, this.blockID, l, 4);
    }
}
 
開發者ID:TheAwesomeGem,項目名稱:MineFantasy,代碼行數:29,代碼來源:BlockSaplingMF.java

示例2: growTree

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
/**
 * Attempts to grow a sapling into a tree
 */
public void growTree(World par1World, int par2, int par3, int par4, Random par5Random)
{
    if (!TerrainGen.saplingGrowTree(par1World, par5Random, par2, par3, par4)) return;

    int l = par1World.getBlockMetadata(par2, par3, par4) & 3;
    Object object = null;
    int i1 = 0;
    int j1 = 0;
   boolean flag = false;
   object = new WorldGenCustomTree(true);

        par1World.setBlock(par2, par3, par4, 0, 0, 4);
    

    if (!((WorldGenerator)object).generate(par1World, par5Random, par2 + i1, par3, par4 + j1))
    {
       
            par1World.setBlock(par2, par3, par4, this.blockID, l, 4);
        }
    }
 
開發者ID:MinecraftModArchive,項目名稱:Runes-And-Silver,代碼行數:24,代碼來源:RuneSapling.java

示例3: growTree

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
/**
 * Attempts to grow a sapling into a tree
 */
public void growTree(World par1World, int par2, int par3, int par4, Random par5Random)
{
    if (!TerrainGen.saplingGrowTree(par1World, par5Random, par2, par3, par4)) return;

    int l = par1World.getBlockMetadata(par2, par3, par4) & 3;
    Object object = null;
    int i1 = 0;
    int j1 = 0;
   boolean flag = false;
   object = new ForestTree();

        par1World.setBlock(par2, par3, par4, 0, 0, 4);
    

    if (!((WorldGenerator)object).generate(par1World, par5Random, par2 + i1, par3, par4 + j1))
    {
       
            par1World.setBlock(par2, par3, par4, this.blockID, l, 4);
        }
    }
 
開發者ID:MinecraftModArchive,項目名稱:Runes-And-Silver,代碼行數:24,代碼來源:ForestTreeSeed.java

示例4: generateTree

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
@Override
public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (!TerrainGen.saplingGrowTree(worldIn, rand, pos)) return;
    WorldGenerator worldgenerator;// = (WorldGenerator)(rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true));
    int i = 0;
    int j = 0;
    boolean flag = false;

    worldgenerator = new CPCherryTreeGen(4, false);

    IBlockState iblockstate2 = Blocks.AIR.getDefaultState();

    worldIn.setBlockState(pos, iblockstate2, 4);

    if (!worldgenerator.generate(worldIn, rand, pos.add(i, 0, j)))
    {
        worldIn.setBlockState(pos, state, 4);
    }
}
 
開發者ID:Othlon,項目名稱:CherryPig,代碼行數:21,代碼來源:CPCherrySapling.java

示例5: generateTree

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
public void generateTree(World world, BlockPos pos, IBlockState state, Random rand) {
    if (!TerrainGen.saplingGrowTree(world, rand, pos)) {
        return;
    }
    WorldGenAbstractGenesisTree generator = treeType.getTreeGenerator(rand);
    if (generator != null) {
        boolean largeTree = treeType.growsIntoLargeTree();
        int x = 0;
        int z = 0;
        IBlockState air = Blocks.AIR.getDefaultState();

        if (largeTree) {
            world.setBlockState(pos.add(x, 0, z), air, WorldFlags.PREVENT_RERENDER);
            world.setBlockState(pos.add(x + 1, 0, z), air, WorldFlags.PREVENT_RERENDER);
            world.setBlockState(pos.add(x, 0, z + 1), air, WorldFlags.PREVENT_RERENDER);
            world.setBlockState(pos.add(x + 1, 0, z + 1), air, WorldFlags.PREVENT_RERENDER);
        } else {
            world.setBlockState(pos, air, WorldFlags.PREVENT_RERENDER);
        }

        if (!generator.generate(world, rand, pos.add(x, 0, z))) {
            if (largeTree) {
                world.setBlockState(pos.add(x, 0, z), state, WorldFlags.PREVENT_RERENDER);
                world.setBlockState(pos.add(x + 1, 0, z), state, WorldFlags.PREVENT_RERENDER);
                world.setBlockState(pos.add(x, 0, z + 1), state, WorldFlags.PREVENT_RERENDER);
                world.setBlockState(pos.add(x + 1, 0, z + 1), state, WorldFlags.PREVENT_RERENDER);
            } else {
                world.setBlockState(pos, state, WorldFlags.PREVENT_RERENDER);
            }
        }

    }
}
 
開發者ID:Boethie,項目名稱:Genesis,代碼行數:34,代碼來源:BlockGenesisSapling.java

示例6: func_149878_d

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
@Override
public final void func_149878_d(World world, int x, int y, int z, Random rand)
{
    if (!TerrainGen.saplingGrowTree(world, rand, x, y, z)) return;

    final int metadata = mask(world.getBlockMetadata(x, y, z));
    final WorldGenerator treeGen = subBlocks.get(metadata).saplingTreeGenerator();
    world.setBlock(x, y, z, Blocks.air, 0, 4);
    if (!treeGen.generate(world, rand, x, y, z)) world.setBlock(x, y, z, this, metadata, 4);
}
 
開發者ID:MinecraftModArchive,項目名稱:KoreSample,代碼行數:11,代碼來源:SaplingBlock.java

示例7: growTree

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
/**
 * Attempts to grow a sapling into a tree
 */
public void growTree(World par1World, int par2, int par3, int par4, Random par5Random)
{
    if (!TerrainGen.saplingGrowTree(par1World, par5Random, par2, par3, par4)) return;

    int l = par1World.getBlockMetadata(par2, par3, par4) & 3;
    Object object = null;
    int i1 = 0;
    int j1 = 0;
    boolean flag = false;

    
        object = new WorldGenCherryTrees(true);

        if (par5Random.nextInt(10) == 0)
        {
            object = new WorldGenBigCherryTrees(true);
        }
    

    if (flag)
    {
        par1World.setBlock(par2 + i1, par3, par4 + j1, 0, 0, 4);
        par1World.setBlock(par2 + i1 + 1, par3, par4 + j1, 0, 0, 4);
        par1World.setBlock(par2 + i1, par3, par4 + j1 + 1, 0, 0, 4);
        par1World.setBlock(par2 + i1 + 1, par3, par4 + j1 + 1, 0, 0, 4);
    }
    else
    {
        par1World.setBlock(par2, par3, par4, 0, 0, 4);
    }

    if (!((WorldGenerator)object).generate(par1World, par5Random, par2 + i1, par3, par4 + j1))
    {
        if (flag)
        {
            par1World.setBlock(par2 + i1, par3, par4 + j1, this.blockID, l, 4);
            par1World.setBlock(par2 + i1 + 1, par3, par4 + j1, this.blockID, l, 4);
            par1World.setBlock(par2 + i1, par3, par4 + j1 + 1, this.blockID, l, 4);
            par1World.setBlock(par2 + i1 + 1, par3, par4 + j1 + 1, this.blockID, l, 4);
        }
        else
        {
            par1World.setBlock(par2, par3, par4, this.blockID, l, 4);
        }
    }
}
 
開發者ID:Stormister,項目名稱:Rediscovered-Mod-1.6.4,代碼行數:50,代碼來源:BlockCherrySapling.java

示例8: growTree

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
public void growTree(World par1World, int par2, int par3, int par4, Random par5Random)
{
	if (!TerrainGen.saplingGrowTree(par1World, par5Random, par2, par3, par4)) return;

    int l = par1World.getBlockMetadata(par2, par3, par4) & 1;
    Object object = null;
    int i1 = 0;
    int j1 = 0;
    boolean flag = false;

    if (l == 0)
    {
        object = new WorldGenPearTree(true);
    }

    if (flag)
    {
        par1World.setBlock(par2 + i1, par3, par4 + j1, 0, 0, 4);
        par1World.setBlock(par2 + i1 + 1, par3, par4 + j1, 0, 0, 4);
        par1World.setBlock(par2 + i1, par3, par4 + j1 + 1, 0, 0, 4);
        par1World.setBlock(par2 + i1 + 1, par3, par4 + j1 + 1, 0, 0, 4);
    }
    
    else
    {
        par1World.setBlock(par2, par3, par4, 0, 0, 4);
    }

    if (!((WorldGenerator)object).generate(par1World, par5Random, par2 + i1, par3, par4 + j1))
    {
        if (flag)
        {
            par1World.setBlock(par2 + i1, par3, par4 + j1, this.blockID, l, 4);
            par1World.setBlock(par2 + i1 + 1, par3, par4 + j1, this.blockID, l, 4);
            par1World.setBlock(par2 + i1, par3, par4 + j1 + 1, this.blockID, l, 4);
            par1World.setBlock(par2 + i1 + 1, par3, par4 + j1 + 1, this.blockID, l, 4);
        }
        else
        {
            par1World.setBlock(par2, par3, par4, this.blockID, l, 4);
        }
    } 
}
 
開發者ID:Rasmustof,項目名稱:Kitchenmod,代碼行數:44,代碼來源:BlockSaplings.java

示例9: generateTree

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
@Override
public void generateTree(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull Random rand) {
	if (!TerrainGen.saplingGrowTree(world, rand, pos)) return;

	TintedTreeGenerator gen = new TintedTreeGenerator();

	world.setBlockToAir(pos);

	gen.generateTree(rand, world, pos);
}
 
開發者ID:yolp900,項目名稱:ItsJustaCharm1.10.2Dead,代碼行數:11,代碼來源:BlockTintedSapling.java

示例10: func_149878_d

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
@Override
public void func_149878_d(World world, int x, int y, int z, Random random) {

	if(!TerrainGen.saplingGrowTree(world, random, x, y, z)) return;
	int l = world.getBlockMetadata(x, y, z) & 7;
	Object object = random.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true);
	int i1 = 0;
	int j1 = 0;
	boolean flag = false;

	switch(l) {

	case 0:
		object = new AbstractTreeCocoa();
		break;

	case 1:
		break;

	case 2:
		break;

	case 3:
		break;

	case 4:
		break;

	case 5:
		break;

	default:
		break;

	}

	Block block = Blocks.air;

	if(flag) {

		world.setBlock(x + i1, y, z + j1, block, 0, 4);
		world.setBlock(x + i1 + 1, y, z + j1, block, 0, 4);
		world.setBlock(x + i1, y, z + j1 + 1, block, 0, 4);
		world.setBlock(x + i1 + 1, y, z + j1 + 1, block, 0, 4);

	} else {

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

	}

	if(!((WorldGenerator)object).generate(world, random, x + i1, y, z + j1)) {

		if(flag) {

			world.setBlock(x + i1, y, z + j1, this, l, 4);
			world.setBlock(x + i1 + 1, y, z + j1, this, l, 4);
			world.setBlock(x + i1, y, z + j1 + 1, this, l, 4);
			world.setBlock(x + i1 + 1, y, z + j1 + 1, this, l, 4);

		} else {

			world.setBlock(x, y, z, this, l, 4);

		}

	}

}
 
開發者ID:ErrorCraftLP,項目名稱:Sugarplus,代碼行數:70,代碼來源:BlockCocoaTreeSaplings.java


注:本文中的net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。