本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}