Listen to EntityPushedByEntityAttackEvent for knockback/push#2193
Listen to EntityPushedByEntityAttackEvent for knockback/push#2193wizjany merged 1 commit intoEngineHub:version/7.0.xfrom
Conversation
Listening to the push event instead of EntityKnockbackByEntity includes other sources of knockback/push in the internal DamageEntityEvent.
|
As far as I can tell from your comment, the EKBE handler will fire on an EPBEAE as well. Why do we need to change the event here? It seems that EKBE should be a superset of EPBEAE, not a subset? edit: ok had to pull up the javadocs. I don't understand the naming ig but the hierarchy is As far as the PVP messages, if that's something that gets spammy, the internal DamageEntityEvent can be setSilent in the common knockback handler. I don't think it makes sense to make it indirect as the knockback pretty directly comes from the player's attack imo. |
I can see how my comments and code there might be confusing. I had a listener for EKBE to catch them all. Could've been EPBEAE instead. The naming of the events doesn't help, I had troubles distinguishing when they should get called as well. There's no explanation in the javadocs about the difference between EKBBEE (EntityByEntity) and EPBEAE. If I got it right you agreed with the choice after looking at the hierarchy? It might get spammy when there are more players around (message for each player), but since that rarely happens I think we're ok. My main concern was the possible confusion, it's a minor thing though and if you lean that way that's all I need, let's keep it verbose. edit: btw. Spigot PR got merged, I'll test tomorrow (GMT+1), but it should work as it is |
|
Adding a log to the SpigotListener for EKBEE.... Doesn't look right, time to reopen on spigot |
|
Fixed on spigot's end, was being called with the wrong entity as attacker. If you agree with the event change for paper it should be good to go. |
EngineHub@a949b10 Skip the hopper doing the pulling. (EngineHub#2186) EngineHub@4ec325e Use chest-access for hoppers pulling from entities. (EngineHub#2191) EngineHub@656cda4 Point readme to compiling file so we don't have to update two places. EngineHub@65792ec Restore previous behavior of ride/interact. (EngineHub#2196) EngineHub@98b5220 Listen to EntityPushedByEntityAttackEvent for knockback/push (EngineHub#2193)
Listening to the push event instead of EntityKnockbackByEntity includes other sources of knockback/push in the internal DamageEntityEvent.
For spigot, after this PR is merged, WG should handle mace AoE knockback as it is.
This is primarily to include the Mace AoE knockback in the pvp flag, but affects other sources of push/knockback as well. Essentially all calls of Entity#push (ex.: ender dragon pushes, arrows, creaking, ravagers). I don't think this should cause any unexpected behaviour, but another opinion would be great.
I tested the effect of this on the pvp flag. It does prevent the knockback/push of the Mace AoE when pvp is denied, but does send a "cannot pvp here" message. Not sure if that's wanted here as it might be confusing since the player is not attacking anyone directly.
Closes #2190