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


Java IToolHammer类代码示例

本文整理汇总了Java中cofh.api.item.IToolHammer的典型用法代码示例。如果您正苦于以下问题:Java IToolHammer类的具体用法?Java IToolHammer怎么用?Java IToolHammer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: hasUsableWrench

import cofh.api.item.IToolHammer; //导入依赖的package包/类
/**
 * Whether or not the player has a usable wrench for a block at the coordinates given.
 * @param player - the player using the wrench
 * @param x - the x coordinate of the block being wrenched
 * @param y - the y coordinate of the block being wrenched
 * @param z - the z coordinate of the block being wrenched
 * @return if the player can use the wrench
 */
public static boolean hasUsableWrench(EntityPlayer player, int x, int y, int z)
{
	ItemStack tool = player.getCurrentEquippedItem();
	
	if(tool.getItem() instanceof IMekWrench && ((IMekWrench)tool.getItem()).canUseWrench(player, x, y, z))
	{
		return true;
	}
	
	if(isBCWrench(tool.getItem()) && ((IToolWrench)tool.getItem()).canWrench(player, x, y, z))
	{
		return true;
	}
	
	if(isCoFHHammer(tool.getItem()) && ((IToolHammer)tool.getItem()).isUsable(tool, player, x, y, z))
	{
		return true;
	}
	
	return false;
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:30,代码来源:MekanismUtils.java

示例2: holdingRotateTool

import cofh.api.item.IToolHammer; //导入依赖的package包/类
protected static boolean holdingRotateTool(final EntityPlayer player) {
	final ItemStack item = player.getCurrentEquippedItem();
	if (item == null)
		return false;

	return item.getItem() instanceof IToolHammer;
}
 
开发者ID:OreCruncher,项目名称:ThermalRecycling,代码行数:8,代码来源:MachineBase.java

示例3: onBlockActivated

import cofh.api.item.IToolHammer; //导入依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
    if (heldItem != null && heldItem.getItem() instanceof IToolHammer && !(heldItem.getItem() instanceof ItemSignToolbox) && ((IToolHammer) heldItem.getItem()).isUsable(heldItem, player, pos)) {
        ItemSignToolbox.doRotate(world, pos, player);
        ((IToolHammer) heldItem.getItem()).toolUsed(heldItem, player, pos);
        return true;
    }

    if (heldItem != null && heldItem.getItem() instanceof ITool && ((ITool) heldItem.getItem()).canUse(heldItem, player, pos)) {
        ItemSignToolbox.doRotate(world, pos, player);
        ((ITool) heldItem.getItem()).used(heldItem, player, pos);
        return true;
    }

    SignInfo signInfo = getSignInfo(world, pos);
    boolean returnVal = true;
    if (signInfo != null && signInfo.property != null) {
        returnVal = signInfo.property.onRightClick(world, pos, state, player, hand, heldItem, side, hitX, hitY, hitZ);
    }

    if (world.isRemote) {
        return returnVal;
    } else {
        TileEntity tileentity = world.getTileEntity(pos);
        return returnVal && (tileentity instanceof TileEntityMoarSign && ((TileEntityMoarSign) tileentity).executeCommand(player));
    }
}
 
开发者ID:GoryMoon,项目名称:MoarSigns,代码行数:28,代码来源:BlockMoarSign.java

示例4: getTool

import cofh.api.item.IToolHammer; //导入依赖的package包/类
@Override
public ITool getTool(@Nonnull ItemStack stack) {
  if (stack.getItem() instanceof IToolHammer) {
    return wrench;
  }
  return null;
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:8,代码来源:TEToolProvider.java

示例5: isTEWrench

import cofh.api.item.IToolHammer; //导入依赖的package包/类
@Override
@Optional.Method(modid = ModIds.COFH_CORE)
protected boolean isTEWrench(Item item){
    return item instanceof IToolHammer;
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:6,代码来源:ModInteractionUtilImplementation.java

示例6: canUse

import cofh.api.item.IToolHammer; //导入依赖的package包/类
@Override
public boolean canUse(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull BlockPos pos) {
  return ((IToolHammer) stack.getItem()).isUsable(stack, player, pos);
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:5,代码来源:TEToolProvider.java

示例7: used

import cofh.api.item.IToolHammer; //导入依赖的package包/类
@Override
public void used(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull BlockPos pos) {
  ((IToolHammer) stack.getItem()).toolUsed(stack, player, pos);
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:5,代码来源:TEToolProvider.java


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