当前位置: 首页>>代码示例>>Java>>正文


Java Blocks.grass方法代码示例

本文整理汇总了Java中net.minecraft.init.Blocks.grass方法的典型用法代码示例。如果您正苦于以下问题:Java Blocks.grass方法的具体用法?Java Blocks.grass怎么用?Java Blocks.grass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.init.Blocks的用法示例。


在下文中一共展示了Blocks.grass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: func_175934_c

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
private void func_175934_c(World worldIn, BlockPos p_175934_2_)
{
    for (int i = 2; i >= -3; --i)
    {
        BlockPos blockpos = p_175934_2_.up(i);
        Block block = worldIn.getBlockState(blockpos).getBlock();

        if (block == Blocks.grass || block == Blocks.dirt)
        {
            this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181635_g);
            break;
        }

        if (block.getMaterial() != Material.air && i < 0)
        {
            break;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:20,代码来源:WorldGenMegaPineTree.java

示例2: func_175927_a

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
private boolean func_175927_a(BlockPos p_175927_1_, World worldIn)
{
    BlockPos blockpos = p_175927_1_.down();
    Block block = worldIn.getBlockState(blockpos).getBlock();

    if ((block == Blocks.grass || block == Blocks.dirt) && p_175927_1_.getY() >= 2)
    {
        this.func_175921_a(worldIn, blockpos);
        this.func_175921_a(worldIn, blockpos.east());
        this.func_175921_a(worldIn, blockpos.south());
        this.func_175921_a(worldIn, blockpos.south().east());
        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:WorldGenHugeTrees.java

示例3: onPlayerInteract

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public static void onPlayerInteract(PlayerInteractEvent event) {
	if (EtFuturum.enableGrassPath)
		if (event.entityPlayer != null) {
			World world = event.entityPlayer.worldObj;
			if (event.action == Action.RIGHT_CLICK_BLOCK)
				if (world.getBlock(event.x, event.y, event.z) == Blocks.grass) {
					ItemStack stack = event.entityPlayer.getCurrentEquippedItem();
					if (stack != null && (stack.getItem() instanceof ItemSpade || isTinkersShovel(stack))) {
						world.setBlock(event.x, event.y, event.z, ModBlocks.grass_path);
						event.entityPlayer.swingItem();
						stack.damageItem(1, event.entityPlayer);
						world.playSoundEffect(event.x + 0.5F, event.y + 0.5F, event.z + 0.5F, Block.soundTypeGravel.getStepResourcePath(), 1.0F, 0.8F);
					}
				}
		}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:17,代码来源:GrassPath.java

示例4: isNotColliding

import net.minecraft.init.Blocks; //导入方法依赖的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: updateTick

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
	super.updateTick(worldIn, pos, state, rand);

	if (worldIn.getLightFromNeighbors(pos.up()) >= 9) {
		float f = BlockCrops.getGrowthChance(this, worldIn, pos);

		if (rand.nextInt((int) (25.0F / f) + 1) == 0) {
			int i = ((Integer) state.getValue(AGE)).intValue();

			if (i < 7) {
				state = state.withProperty(AGE, Integer.valueOf(i + 1));
				worldIn.setBlockState(pos, state, 2);
			} else {
				for (Object enumfacing0 : EnumFacing.Plane.HORIZONTAL) {
					EnumFacing enumfacing = (EnumFacing) enumfacing0;
					if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock() == this.crop) {
						return;
					}
				}

				pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand));
				Block block = worldIn.getBlockState(pos.down()).getBlock();

				if (worldIn.getBlockState(pos).getBlock().blockMaterial == Material.air
						&& (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass)) {
					worldIn.setBlockState(pos, this.crop.getDefaultState());
				}
			}
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:32,代码来源:BlockStem.java

示例6: updateTask

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
/**
 * Updates the task
 */
public void updateTask()
{
    this.eatingGrassTimer = Math.max(0, this.eatingGrassTimer - 1);

    if (this.eatingGrassTimer == 4)
    {
        BlockPos blockpos = new BlockPos(this.grassEaterEntity.posX, this.grassEaterEntity.posY, this.grassEaterEntity.posZ);

        if (field_179505_b.apply(this.entityWorld.getBlockState(blockpos)))
        {
            if (this.entityWorld.getGameRules().getBoolean("mobGriefing"))
            {
                this.entityWorld.destroyBlock(blockpos, false);
            }

            this.grassEaterEntity.eatGrassBonus();
        }
        else
        {
            BlockPos blockpos1 = blockpos.down();

            if (this.entityWorld.getBlockState(blockpos1).getBlock() == Blocks.grass)
            {
                if (this.entityWorld.getGameRules().getBoolean("mobGriefing"))
                {
                    this.entityWorld.playAuxSFX(2001, blockpos1, Block.getIdFromBlock(Blocks.grass));
                    this.entityWorld.setBlockState(blockpos1, Blocks.dirt.getDefaultState(), 2);
                }

                this.grassEaterEntity.eatGrassBonus();
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:38,代码来源:EntityAIEatGrass.java

示例7: validTreeLocation

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
/**
 * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height
 * limit, is valid.
 */
private boolean validTreeLocation()
{
    Block block = this.world.getBlockState(this.basePos.down()).getBlock();

    if (block != Blocks.dirt && block != Blocks.grass && block != Blocks.farmland)
    {
        return false;
    }
    else
    {
        int i = this.checkBlockLine(this.basePos, this.basePos.up(this.heightLimit - 1));

        if (i == -1)
        {
            return true;
        }
        else if (i < 6)
        {
            return false;
        }
        else
        {
            this.heightLimit = i;
            return true;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:32,代码来源:WorldGenBigTree.java

示例8: generate

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public boolean generate(World worldIn, Random rand, BlockPos position)
{
    for (int i = 0; i < 64; ++i)
    {
        BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));

        if (Blocks.melon_block.canPlaceBlockAt(worldIn, blockpos) && worldIn.getBlockState(blockpos.down()).getBlock() == Blocks.grass)
        {
            worldIn.setBlockState(blockpos, Blocks.melon_block.getDefaultState(), 2);
        }
    }

    return true;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:15,代码来源:WorldGenMelon.java

示例9: updateTick

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    super.updateTick(worldIn, pos, state, rand);

    if (worldIn.getLightFromNeighbors(pos.up()) >= 9)
    {
        float f = BlockCrops.getGrowthChance(this, worldIn, pos);

        if (rand.nextInt((int)(25.0F / f) + 1) == 0)
        {
            int i = ((Integer)state.getValue(AGE)).intValue();

            if (i < 7)
            {
                state = state.withProperty(AGE, Integer.valueOf(i + 1));
                worldIn.setBlockState(pos, state, 2);
            }
            else
            {
                for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
                {
                    if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock() == this.crop)
                    {
                        return;
                    }
                }

                pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand));
                Block block = worldIn.getBlockState(pos.down()).getBlock();

                if (worldIn.getBlockState(pos).getBlock().blockMaterial == Material.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass))
                {
                    worldIn.setBlockState(pos, this.crop.getDefaultState());
                }
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:39,代码来源:BlockStem.java

示例10: generate

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public boolean generate(World worldIn, Random rand, BlockPos position)
{
    for (int i = 0; i < 64; ++i)
    {
        BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));

        if (worldIn.isAirBlock(blockpos) && worldIn.getBlockState(blockpos.down()).getBlock() == Blocks.grass && Blocks.pumpkin.canPlaceBlockAt(worldIn, blockpos))
        {
            worldIn.setBlockState(blockpos, Blocks.pumpkin.getDefaultState().withProperty(BlockPumpkin.FACING, EnumFacing.Plane.HORIZONTAL.random(rand)), 2);
        }
    }

    return true;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:15,代码来源:WorldGenPumpkin.java

示例11: grow

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state)
{
    BlockPos blockpos = pos.up();

    for (int i = 0; i < 128; ++i)
    {
        BlockPos blockpos1 = blockpos;
        int j = 0;

        while (true)
        {
            if (j >= i / 16)
            {
                if (worldIn.getBlockState(blockpos1).getBlock().blockMaterial == Material.air)
                {
                    if (rand.nextInt(8) == 0)
                    {
                        BlockFlower.EnumFlowerType blockflower$enumflowertype = worldIn.getBiomeGenForCoords(blockpos1).pickRandomFlower(rand, blockpos1);
                        BlockFlower blockflower = blockflower$enumflowertype.getBlockType().getBlock();
                        IBlockState iblockstate = blockflower.getDefaultState().withProperty(blockflower.getTypeProperty(), blockflower$enumflowertype);

                        if (blockflower.canBlockStay(worldIn, blockpos1, iblockstate))
                        {
                            worldIn.setBlockState(blockpos1, iblockstate, 3);
                        }
                    }
                    else
                    {
                        IBlockState iblockstate1 = Blocks.tallgrass.getDefaultState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.GRASS);

                        if (Blocks.tallgrass.canBlockStay(worldIn, blockpos1, iblockstate1))
                        {
                            worldIn.setBlockState(blockpos1, iblockstate1, 3);
                        }
                    }
                }

                break;
            }

            blockpos1 = blockpos1.add(rand.nextInt(3) - 1, (rand.nextInt(3) - 1) * rand.nextInt(3) / 2, rand.nextInt(3) - 1);

            if (worldIn.getBlockState(blockpos1.down()).getBlock() != Blocks.grass || worldIn.getBlockState(blockpos1).getBlock().isNormalCube())
            {
                break;
            }

            ++j;
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:52,代码来源:BlockGrass.java

示例12: canPlaceBlockOn

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
/**
 * is the block grass, dirt or farmland
 */
protected boolean canPlaceBlockOn(Block ground)
{
    return ground == Blocks.grass || ground == Blocks.dirt || ground == Blocks.farmland;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:8,代码来源:BlockBush.java

示例13: generate

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public boolean generate(World worldIn, Random rand, BlockPos position)
{
    while (true)
    {
        label0:
        {
            if (position.getY() > 3)
            {
                if (worldIn.isAirBlock(position.down()))
                {
                    break label0;
                }

                Block block = worldIn.getBlockState(position.down()).getBlock();

                if (block != Blocks.grass && block != Blocks.dirt && block != Blocks.stone)
                {
                    break label0;
                }
            }

            if (position.getY() <= 3)
            {
                return false;
            }

            int i1 = this.field_150544_b;

            for (int i = 0; i1 >= 0 && i < 3; ++i)
            {
                int j = i1 + rand.nextInt(2);
                int k = i1 + rand.nextInt(2);
                int l = i1 + rand.nextInt(2);
                float f = (float)(j + k + l) * 0.333F + 0.5F;

                for (BlockPos blockpos : BlockPos.getAllInBox(position.add(-j, -k, -l), position.add(j, k, l)))
                {
                    if (blockpos.distanceSq(position) <= (double)(f * f))
                    {
                        worldIn.setBlockState(blockpos, this.field_150545_a.getDefaultState(), 4);
                    }
                }

                position = position.add(-(i1 + 1) + rand.nextInt(2 + i1 * 2), 0 - rand.nextInt(2), -(i1 + 1) + rand.nextInt(2 + i1 * 2));
            }

            return true;
        }
        position = position.down();
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:52,代码来源:WorldGenBlockBlob.java

示例14: func_150523_a

import net.minecraft.init.Blocks; //导入方法依赖的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:SkidJava,项目名称:BaseClient,代码行数:6,代码来源:WorldGenAbstractTree.java

示例15: func_175793_a

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
protected boolean func_175793_a(IBlockState p_175793_1_, IBlockState p_175793_2_)
{
    return p_175793_1_.getBlock() == Blocks.stone ? true : (p_175793_1_.getBlock() == Blocks.dirt ? true : (p_175793_1_.getBlock() == Blocks.grass ? true : (p_175793_1_.getBlock() == Blocks.hardened_clay ? true : (p_175793_1_.getBlock() == Blocks.stained_hardened_clay ? true : (p_175793_1_.getBlock() == Blocks.sandstone ? true : (p_175793_1_.getBlock() == Blocks.red_sandstone ? true : (p_175793_1_.getBlock() == Blocks.mycelium ? true : (p_175793_1_.getBlock() == Blocks.snow_layer ? true : (p_175793_1_.getBlock() == Blocks.sand || p_175793_1_.getBlock() == Blocks.gravel) && p_175793_2_.getBlock().getMaterial() != Material.water))))))));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:MapGenCaves.java


注:本文中的net.minecraft.init.Blocks.grass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。