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.
@e
cannot target dead players. Only the @a
selector can (as well as the upcoming @s
selector, though is irrelevant when you'd need to use @a
first for @s
to be functional), and only if the r/dx/dy/dz
parameters are not specified.
execute @a[score_deaths_min=1] ~ ~ ~ summon minecraft:armor_stand
Best Answer
Because Minecraft commands have no
event
system, you cannot just say: 'run when someone dies'. Instead, you need to keep track of a separatedeathCount
variable that constantly get set back to zero. The purpose of this is to detect when a player dies. If they die, their score goes up by one, your commands run, then it goes back to zero. If they don't die, nothing happens. Therefore, you use this temporary variable to detect when they die, because if they are to die, their score goes up by one for one, and only one iteration of a command block chain.To summarize, you keep track of two
deathCount
variables. One is the normal one, to tell you how many times they have died in total, so you know which platform to teleport them to. The other is aTemp
variable, which serves only to tell you when they die, so you are not constantly teleporting them to a specific spot, but only when and if they die.Setup
An example loop