/** Handles a players right click */ public boolean onPlayerRightClick( EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7) { syncCurrentPlayItem(); netClientHandler.addToSendQueue( new Packet15Place(par4, par5, par6, par7, par1EntityPlayer.inventory.getCurrentItem())); int i = par2World.getBlockId(par4, par5, par6); if (i > 0 && Block.blocksList[i].blockActivated(par2World, par4, par5, par6, par1EntityPlayer)) { return true; } if (par3ItemStack == null) { return false; } if (creativeMode) { int j = par3ItemStack.getItemDamage(); int k = par3ItemStack.stackSize; boolean flag = par3ItemStack.useItem(par1EntityPlayer, par2World, par4, par5, par6, par7); par3ItemStack.setItemDamage(j); par3ItemStack.stackSize = k; return flag; } else { return par3ItemStack.useItem(par1EntityPlayer, par2World, par4, par5, par6, par7); } }
/** Handles a players right click */ public boolean onPlayerRightClick( EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7) { this.syncCurrentPlayItem(); this.netClientHandler.addToSendQueue( new Packet15Place(par4, par5, par6, par7, par1EntityPlayer.inventory.getCurrentItem())); if (par3ItemStack != null && par3ItemStack.getItem() != null && par3ItemStack .getItem() .onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7)) { return true; } int var8 = par2World.getBlockId(par4, par5, par6); if (var8 > 0 && Block.blocksList[var8].blockActivated(par2World, par4, par5, par6, par1EntityPlayer)) { return true; } else if (par3ItemStack == null) { return false; } else if (this.creativeMode) { int var9 = par3ItemStack.getItemDamage(); int var10 = par3ItemStack.stackSize; boolean var11 = par3ItemStack.useItem(par1EntityPlayer, par2World, par4, par5, par6, par7); par3ItemStack.setItemDamage(var9); par3ItemStack.stackSize = var10; return var11; } else { if (!par3ItemStack.useItem(par1EntityPlayer, par2World, par4, par5, par6, par7)) { return false; } if (par3ItemStack.stackSize <= 0) { ForgeHooks.onDestroyCurrentItem(par1EntityPlayer, par3ItemStack); } return true; } }
public boolean activeBlockOrUseItem( EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l) { int i1 = world.getBlockId(i, j, k); if (i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer)) { return true; } if (itemstack == null) { return false; } else { return itemstack.useItem(entityplayer, world, i, j, k, l); } }