Type the mob's ID in the bar, and click save. You won't be able to hit that kind of mob until you remove it. For example, I added villagers.
The button in the inventory.
Adds a button to disable the ability to attack configurable mobs. No more accidentally attacking your pets or villagers!