本文整理汇总了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;
}
示例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;
}
示例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));
}
}
示例4: getTool
import cofh.api.item.IToolHammer; //导入依赖的package包/类
@Override
public ITool getTool(@Nonnull ItemStack stack) {
if (stack.getItem() instanceof IToolHammer) {
return wrench;
}
return null;
}
示例5: isTEWrench
import cofh.api.item.IToolHammer; //导入依赖的package包/类
@Override
@Optional.Method(modid = ModIds.COFH_CORE)
protected boolean isTEWrench(Item item){
return item instanceof IToolHammer;
}
示例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);
}
示例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);
}