Add lastDamageSource to living entities
Is your feature request related to a problem?
Supporting lastDamageSource is from my perspective a better implementation to lastDamageCause and provides the same and more information to the users. Especially in cases where a custom damage type might be defined.
Describe the solution you'd like.
I would like a method added onto LivingEntity preferably like #getLastDamageSource matching it along with getLastDamage and getLastDamageCause
Describe alternatives you've considered.
I haven't considered any alternatives to this implementation
Other
While I'm aware that getLastDamageCause returns EntityDamageEvent I find this behavior of it in poor taste, I would rather use a method provided by minecraft than one that I assume is custom made by the server.
Have you looked at the CombatTracker API? the last CombatEntry provides you with a bunch of information, including the damage source.
A convenience method for that on LivingEntity itself might be neat though.
I have looked over it but since the only reliable way I could see of getting last being through the list of all entries, I wasn't sure if they stored in the order of being added enabling CombatTracker#getCombatEntries().getLast()
I have looked over it but since the only reliable way I could see of getting last being through the list of all entries, I wasn't sure if they stored in the order of being added enabling
CombatTracker#getCombatEntries().getLast()
you can try but i remember is added in order.