Minecraft – unkillable mobs

minecraft-java-edition

So lets say I'm making a map in Minecraft. No mods, no bukkit, no anything; just command blocks. and I have this one mob that I don't want players to be able to kill.

Normally, I would simply give it a resistance potion so that it couldn't be hurt, but I want other mobs to be able to hurt it, just not players.

Is it possible to make this mob unkillable by players, but still able to die by other mobs?

Best Answer

/summon ExampleMob ~ ~ ~ {Invulnerable:1}