Making mobs invincible
Is there a way to make mobs invincible? I have already spent a while looking for it on google, but all I get is people telling me to give it a resistance potion effect. I am sure there is some attribute that I can give a summoned mob to make it invincible, but I don't know how to do it. How can I do this?
Solution 1:
For simply making mobs invincible, this method is now outdated, see David Toh's solution using the new "Invulnerable" tag.
You need to use a resistance effect of level 5 or higher. This is the closest to a simple invincible tag we have at the moment, it gives the mob 100% resistance to damage, so is effectively the same thing. To summon a mob with an effect, you use the tags
{ActiveEffects:[{Id: x ,Amplifier: x ,Duration: x }]}
So for an invincible skeleton, you would say:
/summon Skeleton ~ ~2 ~ {ActiveEffects:[{Id:11,Amplifier:5,Duration:10000000}]}
The only way to kill this mob will then be either through mods, or using void damage (falling out of the world).
Extra Note: The mob may still de-spawn if it's not in a loaded area, to avoid this you can name your mob:
/summon Skeleton ~ ~2 ~ {CustomName:Example Name,CustomNameVisible:1,ActiveEffects:[{Id:11,Amplifier:5,Duration:10000000}]}
Replace "Example Name" with a name of your choice.
In answer to the comment about using multiple effects:
You can have as many effects as you like by formatting your active effects section of the summon like so:
ActiveEffects:[{Id:11,Amplifier:5,Duration:10000000},{Id:14,Amplifier:1,Duration:10000000}]
Full command for invincible and invisible skeleton named "Example Name"
/summon Skeleton ~ ~2 ~ {CustomName:Example Name,CustomNameVisible:1,ActiveEffects:[{Id:11,Amplifier:5,Duration:10000000},{Id:14,Amplifier:1,Duration:10000000}]}
Solution 2:
The answer is way simpler now you can now make mobs FULLY invincible. Here's how:
/summon Cow ~0 ~0 ~0 {Invulnerable:1}
Easy! If you want to spawn any other mob, just change the "Cow" to the name of whatever mob you like. If you were to spawn a zombie, the zombie will still burn in daylight but will not take any damage from it.
IMPORTANT NOTE: When typing out the command, the mob's name must be EXACT. For example if I wanted to spawn a zombie, I cant type:
/summon zombie ~0 ~0 ~0 {Invulnerable:1}
You will just receive the message: "Unable to summon object". Instead, you have to type the name of the mob with ALL NECESSARY CAPS:
/summon Zombie ~0 ~0 ~0 {Invulnerable:1}
OR
/summon Skeleton ~0 ~0 ~0 {Invulnerable:1}
mobs with two names will have their own name, e.g: zombie pigman :PigZombie, snow golem :SnowMan iron golem : VillagerGolem cave spider : CaveSpider magma cube : LavaSlime ender dragon : EnderDragon.
Solution 3:
Thanks to @DBS for answering my question. For those who are wondering, this is what I was trying to accomplish with this newly gained knowledge. A flying boat. Here is the full command for those who want it:
/summon Boat ~ ~ ~ {riding:{Id:Bat{CustomName:Plane,CustomNameVisible:1,ActiveEffects:[{Id:11,Amplifier:5,Duration:372000},{Id:14,Amplifier:5,Duration:372000},{Id:1,Amplifier:1,Duration:372000},{Id:2,Amplifier:255,Duration:2}]}}}