I didn't mean it that way - Villager Protection from Accidental Hits
This mod solves the common problem of accidentally damaging villagers in Minecraft. Now, if you hit a villager with an empty hand, they won't take damage and won't get angry at you.
An additional option is available in the settings: villagers only take damage when tools are used. Any other items in hand, including empty hands, won't harm NPCs.
Especially useful for players with unstable trackpads or mice that sometimes spontaneously click the left button during gameplay.