/summon EnderDragon ~ ~ ~ {NoAI:1}
summons an Ender Dragon that does not take any damage, melee or ranged (projectiles simply pass through it as if it weren't even there).
Compare this to using
/entitydata @e[type=EnderDragon,c=1] {NoAI:1}
which causes it to glitch (MC-74113), but it is able to take damage (until you fix that issue by relogging).
Related issues
is duplicated by
Attachments
Comments


This also affects tp commands. Dragon aren't rendered in new locations unless logging out/in happens

Also related to MC-73719.

confirmed for 15w31b

confirmed for 15w36c

Confirmed for 15w38b

Added two screenshots. Same Dragon, both times had NoAI:true but the one that was damaged was issued the command while moving, which caused it to shake (see MC-74113). I exited the world, and relogged. The Dragon was was not shaking but could not be damaged.

This might be intended per Searge's comment on NoAI issues
If changing NBT via commands does not have the expected effect, that's always considered "working as intended".

As @unknown has made clear elsewhere, the NoAI tag can have unexpected results because of how some behavior and mechanics are implemented. The Ender Dragon is a complicated mob, especially after the fight was reworked in 1.9, and was not designed to work outside of that context. Too much of its behavior is dependent on multiple pieces working together, and when you fiddle with its internals, they no longer function predictably.