Minecraft Commands – How to Test If an Entity Was Killed in Minecraft Java Edition

minecraft-commandsminecraft-java-edition

I need a way to summon an item where an entity died, I tried this:

testfor @e[name=bob] {DeathTime:1s}

Best Answer

Maybe run these commands every tick?

/execute @e[name=bob] ~ ~ ~ kill @e[type=armor_stand,c=1,r=20,name=deathDetect]

/execute @e[type=armor_stand,name=deathDetect] ~ ~ ~ summon item ~ ~ ~ {Item:{id:"minecraft:diamond",Count:1}}

/kill @e[type=armor_stand,name=deathDetect]

/execute @e[name=bob] ~ ~ ~ summon armor_stand ~ ~ ~ {CustomName:"deathDetect",Invisible:1,Marker:1,NoGravity:1}