Sometimes you may be trying to plant an item (eg fence), or access your chest etc, however the action may result in another player or animal around/behind you to be attacked. This has happened to me countless times, even up to 5 squares behind/beside me.
Now my sheep won't die! Thank you Mojang people!