[Resolved] Damage event

how can i get damage event?
what is the event? plz

DamageEntityEvent

1 Like

yes, but when i hit a mob nothings happends…

I don’t think it’s implemented yet, try InteractEntityEvent.Primary

There used to be an InteractEntityEvent.Attack has that been moved into Primary again?

InteractEntityEvent.Attack was a duplicate of DamageEntityEvent

But DamageEntityEvent is not cancellable? And InteractEntityEvent.Attack was. If i was cancelling the InteractEntityEvent.Attack what do i cancel now instead?

At present, when hitting an entity, the event InteractEntityEvent.Primary is fired followed by DamageEntityEvent.

If Primary is cancelled, the whole thing is cancelled and DamageEntityEvent is never fired.
DamageEntityEvent is fired once we know the entity is being damaged and the event allows you to modify what damage is dealt.

2 Likes

So DamageEntityEvent will always cause the entity to be knocked back but become invulnerable (even if set to 0 damage?), but cancelling the interact event will prevent them from even being touched, right?

If the result of DamageEntityEvent is 0 damage then I would think nothing will happen.

Correct

As DamageEntityEvent is not implemented yet I cannot say for certain how the behavior works for the event but the javadocs should describe in enough detail.

Status on this event?

i think it’s not implemeted fully yet,
i wait, i wait

Just replying as I merged the DamageEntityEvent implementation last night. It works through all my testing, though there may be some kinks, so if there’s any, please raise an issue in SpongeCommon.

1 Like