當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。