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


Java IGrowable.canUseBonemeal方法代码示例

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


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

示例1: applyBonemeal

import net.minecraft.block.IGrowable; //导入方法依赖的package包/类
public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target)
{
    IBlockState iblockstate = worldIn.getBlockState(target);

    if (iblockstate.getBlock() instanceof IGrowable)
    {
        IGrowable igrowable = (IGrowable)iblockstate.getBlock();

        if (igrowable.canGrow(worldIn, target, iblockstate, worldIn.isRemote))
        {
            if (!worldIn.isRemote)
            {
                if (igrowable.canUseBonemeal(worldIn, worldIn.rand, target, iblockstate))
                {
                    igrowable.grow(worldIn, worldIn.rand, target, iblockstate);
                }

                --stack.stackSize;
            }

            return true;
        }
    }

    return false;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:ItemDye.java

示例2: applyBonemeal

import net.minecraft.block.IGrowable; //导入方法依赖的package包/类
public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target)
{
    IBlockState iblockstate = worldIn.getBlockState(target);

    if (iblockstate.getBlock() instanceof IGrowable)
    {
        IGrowable igrowable = (IGrowable)iblockstate.getBlock();

        if (igrowable.canGrow(worldIn, target, iblockstate, worldIn.isRemote))
        {
            if (!worldIn.isRemote)
            {
                if (igrowable.canUseBonemeal(worldIn, worldIn.rand, target, iblockstate))
                {
                    igrowable.grow(worldIn, worldIn.rand, target, iblockstate);
                }

                stack.func_190918_g(1);
            }

            return true;
        }
    }

    return false;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:27,代码来源:ItemDye.java

示例3: applyBonemeal

import net.minecraft.block.IGrowable; //导入方法依赖的package包/类
public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos pos, IBlockState state, EntityPlayer player, @javax.annotation.Nullable EnumHand hand) {
    if (!(state.getBlock() instanceof BlockGrass) || player.isSneaking()) {

        int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, worldIn, pos, state, stack, hand);
        if (hook != 0) return hook > 0;

        IGrowable igrowable = (IGrowable) state.getBlock();
        if (igrowable.canGrow(worldIn, pos, state, worldIn.isRemote)) {
            if (!worldIn.isRemote) {
                if (igrowable.canUseBonemeal(worldIn, worldIn.rand, pos, state)) {
                    igrowable.grow(worldIn, worldIn.rand, pos, state);
                }
                stack.damageItem(1, player);
            }
            return true;
        }
    }
    return false;
}
 
开发者ID:NightKosh,项目名称:Gravestone-mod-Extended,代码行数:20,代码来源:ItemBoneHoe.java

示例4: applyUnko

import net.minecraft.block.IGrowable; //导入方法依赖的package包/类
private boolean applyUnko(ItemStack stack, World worldIn, BlockPos pos, EntityPlayer player) {
       IBlockState iblockstate = worldIn.getBlockState(pos);
       Block block = iblockstate.getBlock();

       if (block instanceof IGrowable)
       {
           IGrowable igrowable = (IGrowable)block;

           if (igrowable.isStillGrowing(worldIn, pos, iblockstate, worldIn.isRemote))
           {
               if (!worldIn.isRemote)
               {
                   if (igrowable.canUseBonemeal(worldIn, worldIn.rand, pos, iblockstate))
                   {
                       igrowable.grow(worldIn, worldIn.rand, pos, iblockstate);
                   }

                   --stack.stackSize;
               }

               return true;
           }
       }

       return false;
}
 
开发者ID:shu3,项目名称:FatCatMOD,代码行数:27,代码来源:ItemFatCatUnko.java

示例5: applyBonemeal

import net.minecraft.block.IGrowable; //导入方法依赖的package包/类
public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target, EntityPlayer player)
{
    IBlockState iblockstate = worldIn.getBlockState(target);

    int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, worldIn, target, iblockstate, stack);
    if (hook != 0) return hook > 0;

    if (iblockstate.getBlock() instanceof IGrowable)
    {
        IGrowable igrowable = (IGrowable)iblockstate.getBlock();

        if (igrowable.canGrow(worldIn, target, iblockstate, worldIn.isRemote))
        {
            if (!worldIn.isRemote)
            {
                if (igrowable.canUseBonemeal(worldIn, worldIn.rand, target, iblockstate))
                {
                    igrowable.grow(worldIn, worldIn.rand, target, iblockstate);
                }

                --stack.stackSize;
            }

            return true;
        }
    }

    return false;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:30,代码来源:ItemDye.java

示例6: onItemUse

import net.minecraft.block.IGrowable; //导入方法依赖的package包/类
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
	super.onItemUse(stack, playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);

	if (this.getMaterialName() == zivicioToolMaterial.toString() && PrimordialConfig.enableZivicioHoeSpeedup) {

		IBlockState iblockstate = worldIn.getBlockState(pos);
		Block block = iblockstate.getBlock();

		if (block != null && block instanceof IGrowable) {
			IGrowable igrowable = (IGrowable) block;
			if (igrowable.canGrow(worldIn, pos, iblockstate, worldIn.isRemote)) {
				if (!worldIn.isRemote) {
					if (igrowable.canUseBonemeal(worldIn, worldIn.rand, pos, iblockstate)) {
						//igrowable.grow(worldIn, worldIn.rand, pos, iblockstate); // no client side update
						//iblockstate.getBlock().updateTick(worldIn, pos, iblockstate, worldIn.rand); // no client side update
						//LogHelper.info("update");
						worldIn.scheduleUpdate(pos, block, 1);
					}
				} else {
					//LogHelper.info("spawn" + igrowable.toString());
					spawnBonemealParticles(worldIn, pos, 5);
				}
			}
		}
	}
	return EnumActionResult.PASS;
}
 
开发者ID:KillBait,项目名称:PrimordialCrops,代码行数:29,代码来源:PrimordialHoe.java

示例7: applyBonemeal

import net.minecraft.block.IGrowable; //导入方法依赖的package包/类
public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target, EntityPlayer player)
{
	IBlockState iblockstate = worldIn.getBlockState(target);

	int hook = net.minecraftforge.event.ForgeEventFactory
		           .onApplyBonemeal(player, worldIn, target, iblockstate, stack);
	if (hook != 0)
		return hook > 0;

	if (iblockstate.getBlock() instanceof IGrowable)
	{
		IGrowable igrowable = (IGrowable) iblockstate.getBlock();

		if (igrowable.canGrow(worldIn, target, iblockstate, worldIn.isRemote))
		{
			if (!worldIn.isRemote)
			{
				if (igrowable.canUseBonemeal(worldIn, worldIn.rand, target, iblockstate))
				{
					igrowable.grow(worldIn, worldIn.rand, target, iblockstate);
				}

				stack.damageItem(10, player);
			}

			return true;
		}
	}

	return false;
}
 
开发者ID:MinestrapTeam,项目名称:Minestrappolation-4,代码行数:32,代码来源:ItemMHoe.java

示例8: applyBonemeal

import net.minecraft.block.IGrowable; //导入方法依赖的package包/类
public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target, EntityPlayer player)
{
	IBlockState iblockstate = worldIn.getBlockState(target);

	int hook = net.minecraftforge.event.ForgeEventFactory
		           .onApplyBonemeal(player, worldIn, target, iblockstate, stack);
	if (hook != 0)
		return hook > 0;

	if (iblockstate.getBlock() instanceof IGrowable)
	{
		IGrowable igrowable = (IGrowable) iblockstate.getBlock();

		if (igrowable.canGrow(worldIn, target, iblockstate, worldIn.isRemote))
		{
			if (!worldIn.isRemote)
			{
				if (igrowable.canUseBonemeal(worldIn, worldIn.rand, target, iblockstate))
				{
					igrowable.grow(worldIn, worldIn.rand, target, iblockstate);
				}

				--stack.stackSize;
			}
			return true;
		}
	}
	return false;
}
 
开发者ID:MinestrapTeam,项目名称:Minestrappolation-4,代码行数:30,代码来源:ItemGuano.java


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