Add Entity Death Event ideally with source of the death
MichaelHillcox opened this issue ยท 6 comments
Title kinda says it all, looks like Fabric doesn't have an event for when any kind of entity dies.
Feature requests are more complicated than that.
In order to retain maintainability, portability and discoverability, Fabric API only targets features that are important to a broader set of mods. Whether an addition is desirable is a balance between its
- usefulness,
- complexity,
- inherent necessity for compatibility,
- performance impact,
- continued support by the authors or other interested parties.
Source: https://github.com/FabricMC/fabric/blob/1.19.2/CONTRIBUTING.md#scope
The above section is the only one relevant to feature suggestions, the rest are for other kinds of contributions.
Fabric API doesn't aim to have every event. Why does it need this one?
Is it widely needed by mods, who are currently implementing it themselves or with a 3rd party library?
Is it difficult to implement in a way that's compatible with other implementations?
Or perhaps it's impossible to do that? So a single implementation source is necessary
etc.
For example, LivingEntity.onDeath(DamageSource)
exists. What are the issues with injecting into that via Mixin that make you ask for a FAPI event?
Note that we already have ServerPlayerEvents.ALLOW_DEATH
, so some AFTER_DEATH
event in the same area would make sense.
@Daomephsta I think these simple and reasonably useful events are in scope for Fabric API. ๐
Hmm, how would the performance impact be? Especially if we're running a very big farm. Not sure if we have a event with similar call time. (entity tracking events?)
@apple502j there shouldn't be any noticeable performance impact. Entity deaths are very infrequent compared to entity ticks which are much more expensive than an event dispatch already.
Hi, thanks for the replies, I will note I made this issue as a reminder to modmuss. We were talking in Teamspeak about some missing events and asked me to make this issue as a reminder for him.
Regarding this
For example, LivingEntity.onDeath(DamageSource) exists. What are the issues with injecting into that via Mixin that make you ask for a FAPI event?
Looking for a mob, player, or other entity death is a relatively common requirement for a good selection of mods, having them all mixin into the same place seems like the exact requirement of adding an event for it.
Upon this, it is my understanding that you're able to cancel events / other mods can cancel the remaining events, this would be ideal for instance if you have a mod that prevents a death whilst another mod assumes the death happened and acts upon it. This kind of interaction would not be possible without the addition of the event to the API. The main thing here being that watching for death events is relatively common.
Declaimer, I don't work with fabric a huge amount as I tend to end up working on forge mods, so my knowledge may be lacking here. If I have missed something, please feel free to let me know.