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.

4
  • 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. Commented Jan 12, 2019 at 19:55
  • Minecraft is more strict about adding stuff like b and f at the end of nbt strings. Does DeathTime:1b work? Commented Jan 12, 2019 at 23:48
  • DeathTime:1b also doesn't work. Nor does 1f.
    – Meowl
    Commented Jan 13, 2019 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
    Commented Jan 13, 2019 at 14:32

2 Answers 2

1

I know this is a deadpost, but as people from Google keep landing here I think it's important to point out...

The reason a player or player-command (datapack) can't use death time, is because the only way to get data from an entity is while it's living. It's not a "broken" tag, in that it works internally as it's supposed to (to control death animations, which you can see work properly), and NO entity can run functions for a player AFTER they are dead, so asking the entity to stores it's data in any of the above examples won't work because your commands just can't TARGET the entity at all, not that the entity "isn't doing the proper thing".

Unfortunately tags are made for the vanilla game to run, not for use to fool around with, we just get to fool around with some.

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .