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


Java ForgeHooks.isToolEffective方法代碼示例

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


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

示例1: onItemUse

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
@Override
@SuppressWarnings("deprecation")
   public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
   {
   	if ((this.getStrVsBlock(stack, world.getBlockState(pos)) == this.efficiencyOnProperMaterial || ForgeHooks.isToolEffective(world, pos, stack)) && world.isAirBlock(pos.up()))
   	{
       	if (world.getTileEntity(pos) != null || world.getBlockState(pos).getBlock().getBlockHardness(world.getBlockState(pos), world, pos) == -1.0F)
       	{
       		return EnumActionResult.FAIL;
       	}

       	if (!world.isRemote)
       	{
           	EntityFloatingBlock entity = new EntityFloatingBlock(world, pos, world.getBlockState(pos));
       		world.spawnEntityInWorld(entity);
       		world.setBlockToAir(pos);
       	}

       	stack.damageItem(4, player);
   	}

       return EnumActionResult.SUCCESS;
   }
 
開發者ID:Modding-Legacy,項目名稱:Aether-Legacy,代碼行數:24,代碼來源:ItemGravititeTool.java

示例2: func_150893_a

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
public float func_150893_a(final ItemStack stack, final Block block) {
    for (final ItemStack tool : ItemPrecisionShears.toolStacks) {
        if (ForgeHooks.isToolEffective(tool, block, 0)) {
            return 4.0f;
        }
    }
    return super.func_150893_a(stack, block);
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:9,代碼來源:ItemPrecisionShears.java

示例3: onBlockHarvested

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
@Override
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
{
	if(state.getValue(FILL) > 0 && state.getValue(FILLTYPE) == FillType.Charcoal && 
			ForgeHooks.isToolEffective(worldIn, pos, player.getHeldItemMainhand()))
	{
		Core.giveItem(worldIn, player, pos, new ItemStack(Items.COAL, 1, 1));
		worldIn.setBlockState(pos, state.withProperty(FILL, state.getValue(FILL)-1));
	}
}
 
開發者ID:Deadrik,項目名稱:TFC2,代碼行數:11,代碼來源:BlockPitKiln.java

示例4: getDigSpeed

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta) {
	if (ForgeHooks.isToolEffective(stack, block, meta)) {
		return getDigSpeed(stack);
	}
	return super.getDigSpeed(stack, block, meta);
}
 
開發者ID:iconmaster5326,項目名稱:AetherCraft2,代碼行數:8,代碼來源:ItemForgedTool.java

示例5: getDigSpeed

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
/**
 * Metadata-sensitive version of getStrVsBlock
 * @param itemstack The Item Stack
 * @param block The block the item is trying to break
 * @param metadata The items current metadata
 * @return The damage strength
 */
@Override
public float getDigSpeed(ItemStack itemstack, Block block, int metadata)
{
    if(!this.hasEnoughEnergy(itemstack, energyCostUseSmall)) {
        return 1.0F;
    }
    if (ForgeHooks.isToolEffective(itemstack, block, metadata) || this.isEffectiveAgainst(this.getMode(itemstack), block))
    {
        return efficiencyOnProperMaterial;
    }

    return super.getDigSpeed(itemstack, block, metadata);
    //return func_150893_a(itemstack, block);
}
 
開發者ID:katzenpapst,項目名稱:amunra,代碼行數:22,代碼來源:ItemNanotool.java

示例6: getDigSpeed

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta)
{
    if(ForgeHooks.isToolEffective(stack, block, meta))
    {
        int tension = NBTHelper.getInt(stack, NBTTags.TENSION_ENERGY); if(tension <= 0) { return 1.0F; }
        int speed = NBTHelper.getInt(stack, NBTTags.SPEED); if(speed <= 0) { return 1.0F; }
        return super.getDigSpeed(stack, block, meta) * 3.0F;
    }
    return func_150893_a(stack, block);
}
 
開發者ID:Lumaceon,項目名稱:ClockworkPhase,代碼行數:12,代碼來源:ItemTemporalClockworkAxe.java

示例7: getDigSpeed

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta)
{
    if(ForgeHooks.isToolEffective(stack, block, meta))
    {
        int tension = NBTHelper.getInt(stack, NBTTags.TENSION_ENERGY); if(tension <= 0) { return 1.0F; }
        int speed = NBTHelper.getInt(stack, NBTTags.SPEED); if(speed <= 0) { return 1.0F; }
        return (float)speed / 20;
    }
    return func_150893_a(stack, block);
}
 
開發者ID:Lumaceon,項目名稱:ClockworkPhase,代碼行數:12,代碼來源:ItemClockworkAxe.java

示例8: canHarvestBlock

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
@Override
/**
    * Returns if the item (tool) can harvest results from the block type.
    */
   public boolean canHarvestBlock(Block block, ItemStack stack)
   {
       return ForgeHooks.isToolEffective(stack, block, material.getHarvestLevel());
   }
 
開發者ID:TheAwesomeGem,項目名稱:MineFantasy,代碼行數:9,代碼來源:ItemWaraxe.java

示例9: canDig

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
public boolean canDig(ITurtleAccess turtle, int x, int y, int z, int side) {
	ItemStack item = getCraftingItem();
	if (item != null) {
		int id = turtle.getWorld().getBlockId(x, y, z);
		if (Block.blocksList[id] != null) return ForgeHooks.isToolEffective(item, Block.blocksList[id], turtle.getWorld().getBlockMetadata(x, y, z));
	}
	
	return false;
}
 
開發者ID:austinv11,項目名稱:PeripheralsPlusPlus,代碼行數:10,代碼來源:UpgradeTool.java

示例10: getBlockDrops

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
public Iterable<ItemStack> getBlockDrops(ITurtleAccess turtle, int x, int y, int z, int side) {
	World world = turtle.getWorld();
	int id = world.getBlockId(x, y, z);
	int meta = world.getBlockMetadata(x, y, z);
	if (Block.blocksList[id] == null || !ForgeHooks.isToolEffective(getCraftingItem(), Block.blocksList[id], meta)) return new ArrayList<ItemStack>(0);
	return Block.blocksList[id].getBlockDropped(world, x, y, z, meta, 0);
}
 
開發者ID:austinv11,項目名稱:PeripheralsPlusPlus,代碼行數:8,代碼來源:UpgradeTool.java

示例11: getDigSpeed

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta)
{
    if (ForgeHooks.isToolEffective(stack, block, meta))
    {
        return efficiencyOnProperMaterial;
    }
    return super.getDigSpeed(stack, block, meta);
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:10,代碼來源:ItemTool.java

示例12: onBlockDestroyed

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase player) {
    if(EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.impact.effectId, stack) <= 0)
        return super.onBlockDestroyed(stack, world, block, x, y, z, player);
    if(!player.worldObj.isRemote) {
        int meta = world.getBlockMetadata(x, y, z);
        if(ForgeHooks.isToolEffective(stack, block, meta)) {
            for(int aa = -1; aa <= 1; ++aa) {
                for(int bb = -1; bb <= 1; ++bb) {
                    int xx = 0;
                    int yy = 0;
                    int zz = 0;
                    if(this.side <= 1) {
                        xx = aa;
                        zz = bb;
                    } else if(this.side <= 3) {
                        xx = aa;
                        yy = bb;
                    } else {
                        zz = aa;
                        yy = bb;
                    }

                    if(!(player instanceof EntityPlayer) || world.canMineBlock((EntityPlayer)player, x + xx, y + yy, z + zz)) {
                        Block bl = world.getBlock(x + xx, y + yy, z + zz);
                        meta = world.getBlockMetadata(x + xx, y + yy, z + zz);
                        if(bl.getBlockHardness(world, x + xx, y + yy, z + zz) >= 0.0F && ForgeHooks.isToolEffective(stack, bl, meta)) {
                            stack.damageItem(1, player);
                            BlockUtils.harvestBlock(world, (EntityPlayer)player, x + xx, y + yy, z + zz, true, 2);
                        }
                    }
                }
            }
        }
        else
            return super.onBlockDestroyed(stack, world, block, x, y, z, player);
    }

    return super.onBlockDestroyed(stack, world, block, x, y, z, player);
}
 
開發者ID:SpitefulFox,項目名稱:ForbiddenMagic,代碼行數:41,代碼來源:ItemMorphShovel.java

示例13: getStrVsBlock

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
/** FORGE: Overridden to allow custom tool effectiveness */
@Override
public float getStrVsBlock(ItemStack stack, Block block, int meta) 
{
    if (ForgeHooks.isToolEffective(stack, block, meta))
    {
        return efficiencyOnProperMaterial;
    }
    return getStrVsBlock(stack, block);
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:11,代碼來源:ItemTool.java

示例14: getStrVsBlock

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
@Override
public float getStrVsBlock(ItemStack itemstack, Block block, int md) {
	if (ForgeHooks.isToolEffective(itemstack, block, md))
		return efficiencyOnProperMaterial;

	return getStrVsBlock(itemstack, block);
}
 
開發者ID:ForestryMC,項目名稱:ForestryLegacy,代碼行數:8,代碼來源:ItemScoop.java

示例15: getDigSpeed

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
@Override
public float getDigSpeed(ItemStack itemStack, Block block, int metadata)
{
	return ForgeHooks.isToolEffective(itemStack, block, metadata) ? 4.8f : func_150893_a(itemStack, block);
}
 
開發者ID:MagicBees,項目名稱:MagicBees,代碼行數:6,代碼來源:ItemThaumiumGrafter.java


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