I've been working on a concept for an arena-style players-vs-mobs mini game in vanilla minecraft. I'm looking for a way to keep mobs from taking damage from creeper explosions using commands and command blocks. Does anyone know of a simple way to do this? I've already tried placing non-player mobs on the same team and removing friendlyfire, but creeper explosions still kill other mobs.
Well, after some serious testing, I found an alternative for accomplishing this in vanilla. Not a super simple solution, but in case anyone is curious, here's what I did...
By summoning creepers with a riding armor stand with certain settings(making them invisible, invulnerable, markers), as well as super fast command block redstone clocks, I found I could detect the moment the armor stand ceases to be riding the creeper, which happens to occur right at the time of explosion(or VERY close). Creepers also have an explosion radius tag, which happens to not cause damage when set to 0. From there, I'm working out a way to summon a damage potion from the armor stand that damages only players using the /execute command! It should work well once I figure it out. I've already worked out how to summon a firework from the location, which happens basically instantaneously at the time of the creeper explosion.
Using a very similar method, I was able to detect when the creeper's health reached 0 using the armor stand, thus effectively targeting the location of a dead creeper. Since the death animation has to finish playing before the armor stand ceases to ride the creeper, I'm able to execute commands on the armor stand and destroy it, all before the death animation is complete. This means that I am able to distinguish death types of a creeper! Even make completely custom drops, or do anything I can think of within the realm of vanilla commands on the death of a creeper.
Happy crafting! Hope this helps someone.
[UPDATE]: Instead of a summoning a potion at the time of death, I instead targeted all non-player entities in a certain radius from the armor stand riding the creeper at the time of explosion and applied an ActiveEffects tag with resistance*5 for about one tick. I then summoned a primed creeper to explode during this split second of immunity using the Fuse:0 tag. It works well, as all of this happens within milliseconds using scoreboard dummy objectives and setblock/fill command block clocks.
If you have tried the lucky blocks mod, this answer is useless - but sometimes mobs come and wears diamond armor so in the command block just say: /spawn zombie/skeleton/spider etc. diamond armored skeleton/zombie or any of those mobs. For an example,
/spawn diamond armored zombie.
Another help could be bombfire or at least I think it is a command- I also knew a server - the main mob were creepers. And the creepers did not explode. I do not know how they do it. I was also aware of a plugin you can get to stop the Creepers blowing up, so you need to add a plug in, and you will probably be done!