I have a couple of friends who could be classified as "difficult"...but we've developed such a level of trust over the years that I understand their moods; sometimes we can work through things so that they feel better, other times I have to withdraw and give them space. Occasionally I have my own moods, too, but I try not to inflict them on others ;)
If they are typically nice and moody they can call me whatever they want... at 3 am... etc....
but if they spend their time being 99% petty... it's almost impossible for me.
I try to get angry with the action not the person... so if they person is never making an effort to be considerate... I'll avoid them when I can.