当前位置: 首页>>代码示例>>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;未经允许,请勿转载。