-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add timeDamaged to EntityDamageEvent #9704
Conversation
is this different to calling System.currentTimeMillis(); in your event handler? |
I mean, for most intents and purposes, the difference will be minimal unless you're posting that off async; time millis is generally fast enough, so it's not a big deal but I don't exactly see an inherient advantage here; isn't this one of the things that mojang stores a timestamp for the packet? |
If there is ever API for DamageSources and the CombatTracker, I could see a timestamp added to each DamageSource being useful, because then time, involved entities, direction and type of each instance of damage received would be together. Vanilla only tracks combat start and end time as well as the time since the last attack, not timestamps for individual damages. |
The difference (for me) is that EntityDamageEvent is something that can be later accessed off an Entity with
Mostly it's because this is a trivial object addition to an event whereas one would need to start managing HashMaps etc for this which would certainly be (a little) more effort, memory cost, and the like. It's certainly not a vital addition but I could see it being useful for others. All else fails I'll just continue using it in my fork. Like with above, considering that you can fetch |
This is generally the weird area of "I can get the why" but, It feels weird to accept this for just a single set of events, but it would also be weird to shove it for all events. I think this gets into the pattern where people for years have just wanted a general form of mechanism to attach data to event objects |
@Cryptite PR requires rebasing (see https://github.com/PaperMC/Paper/blob/master/CONTRIBUTING.md#rebasing-prs) |
After rebasing, tested PR. Confirmed working |
Yeah, I don't see the point in this. And in general, this API will need to be reworked for the whole proper damagecause system. |
If there were a DamageCause class object, rather than just an enum, that would be a nice place to put something like this. |
Yea I think I'll close this for now. I 100% see the usecase for this, but yea, merging a temporary solution when we know we want a better one down the line seems rough for an API that wants to be backwards compatible if possible. I am glad to see that the patch found a place in Slice however 😉 |
My finest work yet. Just a simple way to fetch the time an EntityDamageEvent happened.
Unsure if we want to use things like epoch time still or whether we're trying to use things like ticks or other time measurements; happy to update as needed if so.