#How to get entity damage post-calculation

27 messages · Page 1 of 1 (latest)

rich apex
#

I need to use EntityEvents.hurt() in order to determine if the damage done to the entity is fatal (rather than use EntityEvents.death() because something fires before it I'm trying to check for)

the problem is that the damage returned from event.damage gives me the initial/raw damage that was dealt to the entity; what I need is the damage actually applied AFTER all the damage calculation is complete. been trying to find something, but I got no dice. Can someone help me out with this please?

tacit kayakBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

autumn tartan
rich apex
#

still a bit new to this

autumn tartan
#
ForgeEvents.onEvent('net.minecraftforge.event.entity.living.LivingDamageEvent', event => {    
})

Forge events go in startup

rich apex
autumn tartan
#

Do you need access to a variable or something from the server script?

rich apex
#

amror, effects, attributes, etc

autumn tartan
#

Then you would you just use it like you would the damageHurt event, even though it's in startup the code will still fire every time the event happens

rich apex
#

I see

autumn tartan
#

They are really only in startup because they can't be reloaded

rich apex
#

wish there was a server method of doing it as I dont have to restart the game each time to try if it works or not

autumn tartan
#

You can assign the event to a global function while you work on it, then you can basically reload it once it's setup

rich apex
#

still new to this kind of thing and Javascript in genearl

autumn tartan
#
global.livingDamageEvent = (event) => {
    // code here //
}

ForgeEvents.onEvent('net.minecraftforge.event.entity.living.LivingDamageEvent', event => {
    global.livingDamageEvent(event)
})
autumn tartan
#

Startup yeah

#

but the first part can technically be anywhere

#

so if you really needed it from the server scope you could use it there

rich apex
#

instead of a server and startup