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


Java IToolWrench类代码示例

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


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

示例1: activate

import buildcraft.api.tools.IToolWrench; //导入依赖的package包/类
@Override
public boolean activate(EntityPlayer player, ItemStack stack) {
    if (player.isSneaking())
        return false;

    if (stack != null) {
        if (stack.getItem() instanceof IToolWrench) {
            if (getPortalController() != null && getPortalController().isFinalized) {
                if (!EnhancedPortals.proxy.networkManager.hasUID(getPortalController())) {
                    if (!worldObj.isRemote) {
                        player.addChatComponentMessage(Localisation.getChatError(EPMod.ID, "noUidSet"));
                        return true;
                    }
                } else {
                    GuiHandler.openGui(player, getPortalController(), EPGuis.NETWORK_INTERFACE_A);
                    return true;
                }
            }
        }
    }

    return false;
}
 
开发者ID:enhancedportals,项目名称:enhancedportals,代码行数:24,代码来源:TileNetworkInterface.java

示例2: activate

import buildcraft.api.tools.IToolWrench; //导入依赖的package包/类
@Override
public boolean activate(EntityPlayer player, ItemStack stack) {
    if (player.isSneaking())
        return false;

    if (stack != null) {
        if (stack.getItem() instanceof IToolWrench) {
            if (getPortalController() != null && getPortalController().isFinalized) {
                GuiHandler.openGui(player, this, EPGuis.TRANSFER_ITEM);
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:enhancedportals,项目名称:enhancedportals,代码行数:17,代码来源:TileTransferItem.java

示例3: activate

import buildcraft.api.tools.IToolWrench; //导入依赖的package包/类
@Override
public boolean activate(EntityPlayer player, ItemStack stack) {
    if (player.isSneaking())
        return false;

    if (stack != null) {
        if (stack.getItem() instanceof IToolWrench) {
            if (getPortalController() != null && getPortalController().isFinalized) {
                GuiHandler.openGui(player, this, EPGuis.TRANSFER_ENERGY);
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:enhancedportals,项目名称:enhancedportals,代码行数:17,代码来源:TileTransferEnergy.java

示例4: activate

import buildcraft.api.tools.IToolWrench; //导入依赖的package包/类
@Override
public boolean activate(EntityPlayer player, ItemStack stack) {
    if (player.isSneaking())
        return false;

    if (stack != null) {
        if (stack.getItem() instanceof IToolWrench) {
            if (getPortalController() != null && getPortalController().isFinalized) {
                GuiHandler.openGui(player, this, EPGuis.TRANSFER_FLUID);
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:enhancedportals,项目名称:enhancedportals,代码行数:17,代码来源:TileTransferFluid.java

示例5: activate

import buildcraft.api.tools.IToolWrench; //导入依赖的package包/类
@Override
public boolean activate(EntityPlayer player, ItemStack stack) {
    if (player.isSneaking())
        return false;

    if (stack != null) {
        if (stack.getItem() instanceof IToolWrench) {
            if (getPortalController() != null && getPortalController().isFinalized) {
                GuiHandler.openGui(player, this, EPGuis.REDSTONE_INTERFACE);
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:enhancedportals,项目名称:enhancedportals,代码行数:17,代码来源:TileRedstoneInterface.java

示例6: activate

import buildcraft.api.tools.IToolWrench; //导入依赖的package包/类
@Override
public boolean activate(EntityPlayer player, ItemStack stack) {
    if (player.isSneaking())
        return false;

    if (stack != null) {
        if (stack.getItem() instanceof IToolWrench) {
            if (getPortalController() != null && getPortalController().isFinalized) {
                GuiHandler.openGui(player, this, EPGuis.MODULE_MANIPULATOR);
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:enhancedportals,项目名称:enhancedportals,代码行数:17,代码来源:TilePortalManipulator.java

示例7: hasUsableWrench

import buildcraft.api.tools.IToolWrench; //导入依赖的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

示例8: onBlockActivated

import buildcraft.api.tools.IToolWrench; //导入依赖的package包/类
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
	if (!world.isRemote) {
		ItemStack equippedItemStack = player.getCurrentEquippedItem();

		if (equippedItemStack != null)
			if (equippedItemStack.getItem() instanceof IToolWrench) // react to Buildcraft Api ToolWrench
			{
				this.handleToolWrenchClick(world, x, y, z, player, equippedItemStack);

				return true;
			}

		return false;
	}

	return true;
}
 
开发者ID:BraynStorm,项目名称:FlowCraft,代码行数:19,代码来源:WrenchableBlock.java

示例9: tryRemovingBlock

import buildcraft.api.tools.IToolWrench; //导入依赖的package包/类
public void tryRemovingBlock(World world, int x, int y, int z, EntityPlayer player) {
	ItemStack held = player.inventory.getCurrentItem();
	boolean doDrop = false;
	if(held.getItem() instanceof IToolWrench && ((IToolWrench)held.getItem()).canWrench(player, x, y, z)) {
		doDrop = true;
		((IToolWrench)held.getItem()).wrenchUsed(player, x, y, z);
	}
	if(doDrop) {
		TileEntityEnder ender = (TileEntityEnder)world.getBlockTileEntity(x, y, z);
		ItemStack item = new ItemStack(this, 1);
		NBTTagCompound enderData = item.getTagCompound();
		if(enderData == null) enderData = new NBTTagCompound();
		enderData.setInteger("eid", ender.getEnderNetID());

		this.breakBlock(world, x, y, z, this.blockID, 0);
		world.setBlockToAir(x, y, z);
		item.setTagCompound(enderData);
		MiscUtils.dropItem(world, x, y, z, item);
	}
}
 
开发者ID:asiekierka,项目名称:endernet,代码行数:21,代码来源:BlockEnder.java

示例10: onBlockActivated

import buildcraft.api.tools.IToolWrench; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{
    super.onBlockActivated(world, x, y, z, entityPlayer, side, hitX, hitY, hitZ);
    if (!world.isRemote)
    {
        // if the Item currently equipped is a wrench and player sneaking,
        // wrench the block
        Item equipped = entityPlayer.getCurrentEquippedItem() != null ? entityPlayer.getCurrentEquippedItem().getItem() : null;
        if (equipped instanceof IToolWrench && ((IToolWrench) equipped).canWrench(entityPlayer, x, y, z) && entityPlayer.isSneaking())
        {
            ((IToolWrench) equipped).wrenchUsed(entityPlayer, x, y, z);
            this.wrenchBlock(world, x, y, z);
            return true;
        }
    }
    return true;
}
 
开发者ID:allout58,项目名称:MinecraftSpaceAgency,代码行数:20,代码来源:BlockWrenchable.java

示例11: onBlockActivated

import buildcraft.api.tools.IToolWrench; //导入依赖的package包/类
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int param1, float param2, float param3, float param4)
{
    TileEntity te = world.getBlockTileEntity(x, y, z);

    if (te instanceof TileElectricEngine)
    {
        TileElectricEngine tile = (TileElectricEngine)te;

        if (entityPlayer.getCurrentEquippedItem() != null)
        {
            if (entityPlayer.getCurrentEquippedItem().getItem() instanceof IToolWrench)
            {
                tile.changeOrientation(true);
                return true;
            }
        }

        return false;
    }

    return false;
}
 
开发者ID:adamros,项目名称:Transducers,代码行数:24,代码来源:BlockElectricEngine.java

示例12: isWrench

import buildcraft.api.tools.IToolWrench; //导入依赖的package包/类
@Override
@Optional.Method(modid = "BuildCraft|Core")
public boolean isWrench(ItemStack itemstack, EntityPlayer player, int x, int y, int z) 
{
	if (itemstack.getItem() instanceof IToolWrench) {
		IToolWrench wrench = (IToolWrench)itemstack.getItem();
		return wrench.canWrench(player, x, y, z);
	}
	return false;
}
 
开发者ID:Quintinity,项目名称:MobCages,代码行数:11,代码来源:IntegrationBuildcraft.java

示例13: activate

import buildcraft.api.tools.IToolWrench; //导入依赖的package包/类
public boolean activate(EntityPlayer player, ItemStack stack) {
    if (player.isSneaking())
        return false;
    
    if (stack != null) {
        if (stack.getItem() instanceof IToolWrench) {
            if (getPortalController() != null && getPortalController().isFinalized && (this instanceof TileFrame || this instanceof TilePortal)) {
                GuiHandler.openGui(player, getPortalController(), EPGuis.PORTAL_CONTROLLER_A);
                return true;
            }
        }
    }
    
    return false;
}
 
开发者ID:enhancedportals,项目名称:enhancedportals,代码行数:16,代码来源:TilePortalPart.java

示例14: activate

import buildcraft.api.tools.IToolWrench; //导入依赖的package包/类
@Override
public boolean activate(EntityPlayer player, ItemStack stack) {
    if (stack != null && stack.getItem() instanceof IToolWrench) {
        if (!isFinalized) {
            if (!worldObj.isRemote) {
                try {
                    configurePortal();
                } catch (PortalException e) {
                    player.addChatComponentMessage(new ChatComponentText(e.getMessage()));
                    return false;
                }

                player.addChatComponentMessage(Localisation.getChatSuccess(EPMod.ID, Locale.CHAT_SUCCESS_PORTAL_CONFIGURE));
                return true;
            }
        } else {
            GuiHandler.openGui(player, this, EPGuis.PORTAL_CONTROLLER_A);
            return true;
        }
    } else if (lastError != null) {
        player.addChatComponentMessage(new ChatComponentText(lastError));
        lastError = null;
        return true;
    }

    return false;
}
 
开发者ID:enhancedportals,项目名称:enhancedportals,代码行数:28,代码来源:TileController.java

示例15: hasUsableWrench

import buildcraft.api.tools.IToolWrench; //导入依赖的package包/类
/**
 * Returns true if the player has a usable wrench equipped.
 */
public static boolean hasUsableWrench(EntityPlayer pPlayer, int pX, int pY, int pZ) {
    ItemStack tool = pPlayer.getCurrentEquippedItem();
    if (tool != null) {
        if (ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|tools") && tool.getItem() instanceof IToolWrench && ((IToolWrench) tool.getItem())
                .canWrench(pPlayer, pX, pY, pZ)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:Nauktis,项目名称:SolarFlux,代码行数:14,代码来源:Utils.java


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