2

I'm currently working on a simple thing where whenever an entity near me dies, it gives me an item. I can do all of this, save for test when an entity dies. On research, many solutions are there for testing for specific entity deaths using scoreboards, but I just want to use the DeathTime NBT tag to test for any mob death. My command is as follows:

execute if entity @e[nbt={DeathTime:1}]

This doesn't detect any mob deaths. Is it possible to use a solution similar to this, or are scoreboards required? Edit: I am not in the snapshot, I'm in 1.13.2.

  • Interesting, that also doesn't work for me. I can't even target dying entities, they disappear from the list instantly. Are you in the snapshot? It has many issues with global vs. chunk entity list, maybe that's one of the problems it causes. – Fabian Röling Jan 12 at 19:55
  • Minecraft is more strict about adding stuff like b and f at the end of nbt strings. Does DeathTime:1b work? – SpiceWeasel Jan 12 at 23:48
  • DeathTime:1b also doesn't work. Nor does 1f. – Meowl Jan 13 at 13:45
  • I've just done some testing, and I don't think DeathTime does what it's supposed to do. Also, it's stored as a short. – MBraedley Jan 13 at 14:32
0

So, turns out DeathTime is broken. I instead just did, in fact, end up using scoreboards. First, I created a score.

/scoreboard objectives add DeathScore minecraft.custom:minecraft.mob_kills

Then, I entered this into a repeating always active cmd block: execute if score User1 DeathScore matches 1.. run give User1 minecraft:skeleton_skull A chain always active command block chained to this says:

execute if score User1 DeatchScore matches 1.. run scoreboard players remove User1 DeathScore 1

This mean that even with a sweeping edge sword killing two mobs, I got two skulls.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.