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


Java Material.leaves方法代碼示例

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


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

示例1: func_175925_a

import net.minecraft.block.material.Material; //導入方法依賴的package包/類
protected void func_175925_a(World worldIn, BlockPos p_175925_2_, int p_175925_3_)
{
    int i = p_175925_3_ * p_175925_3_;

    for (int j = -p_175925_3_; j <= p_175925_3_ + 1; ++j)
    {
        for (int k = -p_175925_3_; k <= p_175925_3_ + 1; ++k)
        {
            int l = j - 1;
            int i1 = k - 1;

            if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i)
            {
                BlockPos blockpos = p_175925_2_.add(j, 0, k);
                Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial();

                if (material == Material.air || material == Material.leaves)
                {
                    this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata);
                }
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:25,代碼來源:WorldGenHugeTrees.java

示例2: breakBlock

import net.minecraft.block.material.Material; //導入方法依賴的package包/類
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    int i = 4;
    int j = i + 1;

    if (worldIn.isAreaLoaded(pos.add(-j, -j, -j), pos.add(j, j, j)))
    {
        for (BlockPos blockpos : BlockPos.getAllInBox(pos.add(-i, -i, -i), pos.add(i, i, i)))
        {
            IBlockState iblockstate = worldIn.getBlockState(blockpos);

            if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(BlockLeaves.CHECK_DECAY)).booleanValue())
            {
                worldIn.setBlockState(blockpos, iblockstate.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4);
            }
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:19,代碼來源:BlockLog.java

示例3: func_175928_b

import net.minecraft.block.material.Material; //導入方法依賴的package包/類
protected void func_175928_b(World worldIn, BlockPos p_175928_2_, int p_175928_3_)
{
    int i = p_175928_3_ * p_175928_3_;

    for (int j = -p_175928_3_; j <= p_175928_3_; ++j)
    {
        for (int k = -p_175928_3_; k <= p_175928_3_; ++k)
        {
            if (j * j + k * k <= i)
            {
                BlockPos blockpos = p_175928_2_.add(j, 0, k);
                Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial();

                if (material == Material.air || material == Material.leaves)
                {
                    this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata);
                }
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:22,代碼來源:WorldGenHugeTrees.java

示例4: isNotColliding

import net.minecraft.block.material.Material; //導入方法依賴的package包/類
/**
 * Checks that the entity is not colliding with any blocks / liquids
 */
public boolean isNotColliding()
{
    if (this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(this.getEntityBoundingBox()))
    {
        BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);

        if (blockpos.getY() < this.worldObj.func_181545_F())
        {
            return false;
        }

        Block block = this.worldObj.getBlockState(blockpos.down()).getBlock();

        if (block == Blocks.grass || block.getMaterial() == Material.leaves)
        {
            return true;
        }
    }

    return false;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:25,代碼來源:EntityOcelot.java

示例5: getTopSolidOrLiquidBlock

import net.minecraft.block.material.Material; //導入方法依賴的package包/類
/**
 * Finds the highest block on the x and z coordinate that is solid or liquid, and returns its y coord.
 */
public BlockPos getTopSolidOrLiquidBlock(BlockPos pos)
{
    Chunk chunk = this.getChunkFromBlockCoords(pos);
    BlockPos blockpos;
    BlockPos blockpos1;

    for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1)
    {
        blockpos1 = blockpos.down();
        Material material = chunk.getBlock(blockpos1).getMaterial();

        if (material.blocksMovement() && material != Material.leaves)
        {
            break;
        }
    }

    return blockpos;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:23,代碼來源:World.java

示例6: func_181631_a

import net.minecraft.block.material.Material; //導入方法依賴的package包/類
void func_181631_a(BlockPos p_181631_1_, float p_181631_2_, IBlockState p_181631_3_)
{
    int i = (int)((double)p_181631_2_ + 0.618D);

    for (int j = -i; j <= i; ++j)
    {
        for (int k = -i; k <= i; ++k)
        {
            if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_181631_2_ * p_181631_2_))
            {
                BlockPos blockpos = p_181631_1_.add(j, 0, k);
                Material material = this.world.getBlockState(blockpos).getBlock().getMaterial();

                if (material == Material.air || material == Material.leaves)
                {
                    this.setBlockAndNotifyAdequately(this.world, blockpos, p_181631_3_);
                }
            }
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:22,代碼來源:WorldGenBigTree.java

示例7: func_175924_b

import net.minecraft.block.material.Material; //導入方法依賴的package包/類
private void func_175924_b(World worldIn, BlockPos p_175924_2_)
{
    Material material = worldIn.getBlockState(p_175924_2_).getBlock().getMaterial();

    if (material == Material.air || material == Material.leaves)
    {
        this.setBlockAndNotifyAdequately(worldIn, p_175924_2_, field_181644_b);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:10,代碼來源:WorldGenSavannaTree.java

示例8: onBlockDestroyed

import net.minecraft.block.material.Material; //導入方法依賴的package包/類
/**
 * Called when a Block is destroyed using this Item. Return true to trigger the "Use Item" statistic.
 */
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn)
{
    if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool)
    {
        return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn);
    }
    else
    {
        stack.damageItem(1, playerIn);
        return true;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:16,代碼來源:ItemShears.java

示例9: getStrVsBlock

import net.minecraft.block.material.Material; //導入方法依賴的package包/類
public float getStrVsBlock(ItemStack stack, Block block)
{
    if (block == Blocks.web)
    {
        return 15.0F;
    }
    else
    {
        Material material = block.getMaterial();
        return material != Material.plants && material != Material.vine && material != Material.coral && material != Material.leaves && material != Material.gourd ? 1.0F : 1.5F;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:13,代碼來源:ItemSword.java

示例10: generate

import net.minecraft.block.material.Material; //導入方法依賴的package包/類
public boolean generate(World worldIn, Random rand, BlockPos position)
{
    int i = this.func_150533_a(rand);

    if (!this.func_175929_a(worldIn, rand, position, i))
    {
        return false;
    }
    else
    {
        this.func_150541_c(worldIn, position.getX(), position.getZ(), position.getY() + i, 0, rand);

        for (int j = 0; j < i; ++j)
        {
            Block block = worldIn.getBlockState(position.up(j)).getBlock();

            if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves)
            {
                this.setBlockAndNotifyAdequately(worldIn, position.up(j), this.woodMetadata);
            }

            if (j < i - 1)
            {
                block = worldIn.getBlockState(position.add(1, j, 0)).getBlock();

                if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves)
                {
                    this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 0), this.woodMetadata);
                }

                block = worldIn.getBlockState(position.add(1, j, 1)).getBlock();

                if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves)
                {
                    this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 1), this.woodMetadata);
                }

                block = worldIn.getBlockState(position.add(0, j, 1)).getBlock();

                if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves)
                {
                    this.setBlockAndNotifyAdequately(worldIn, position.add(0, j, 1), this.woodMetadata);
                }
            }
        }

        return true;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:50,代碼來源:WorldGenMegaPineTree.java

示例11: func_150523_a

import net.minecraft.block.material.Material; //導入方法依賴的package包/類
protected boolean func_150523_a(Block p_150523_1_)
{
    Material material = p_150523_1_.getMaterial();
    return material == Material.air || material == Material.leaves || p_150523_1_ == Blocks.grass || p_150523_1_ == Blocks.dirt || p_150523_1_ == Blocks.log || p_150523_1_ == Blocks.log2 || p_150523_1_ == Blocks.sapling || p_150523_1_ == Blocks.vine;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:6,代碼來源:WorldGenAbstractTree.java

示例12: generate

import net.minecraft.block.material.Material; //導入方法依賴的package包/類
public boolean generate(World worldIn, Random rand, BlockPos position)
{
    Block block;

    while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0)
    {
        position = position.down();
    }

    Block block1 = worldIn.getBlockState(position).getBlock();

    if (block1 == Blocks.dirt || block1 == Blocks.grass)
    {
        position = position.up();
        this.setBlockAndNotifyAdequately(worldIn, position, this.woodMetadata);

        for (int i = position.getY(); i <= position.getY() + 2; ++i)
        {
            int j = i - position.getY();
            int k = 2 - j;

            for (int l = position.getX() - k; l <= position.getX() + k; ++l)
            {
                int i1 = l - position.getX();

                for (int j1 = position.getZ() - k; j1 <= position.getZ() + k; ++j1)
                {
                    int k1 = j1 - position.getZ();

                    if (Math.abs(i1) != k || Math.abs(k1) != k || rand.nextInt(2) != 0)
                    {
                        BlockPos blockpos = new BlockPos(l, i, j1);

                        if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock())
                        {
                            this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata);
                        }
                    }
                }
            }
        }
    }

    return true;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:46,代碼來源:WorldGenShrub.java

示例13: getStrVsBlock

import net.minecraft.block.material.Material; //導入方法依賴的package包/類
public float getStrVsBlock(ItemStack stack, Block block)
{
    return block != Blocks.web && block.getMaterial() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, block)) : 15.0F;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:5,代碼來源:ItemShears.java

示例14: canPlaceBlockAt

import net.minecraft.block.material.Material; //導入方法依賴的package包/類
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
    IBlockState iblockstate = worldIn.getBlockState(pos.down());
    Block block = iblockstate.getBlock();
    return block != Blocks.ice && block != Blocks.packed_ice ? (block.getMaterial() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:7,代碼來源:BlockSnow.java


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