Arqade Asked on August 7, 2021
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.
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.
Correct answer by Meowl on August 7, 2021
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.
Answered by Gorm on August 7, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP