Carry On

Carry On

112M Downloads

Carry On Fires Forge's attack entity event wrongly, breaking other mods by falsely claiming entities are being attacked

KnightMiner opened this issue ยท 3 comments

commented

Expected Behavior

Carry On to not lie to mods telling them an entity is attacked when it is not

Actual Behavior

Carry On's fires an event that extends Forge's AttackEntityEvent. This means it will be caught by all listeners of AttackEntityEvent, which per the forge doc is fired when a player attacks an entity. Since your event is not an entity attack, it should not extend that forge event.

This notably causes problems with Tinkers Construct, as we use that event to handle boosting unarmed attack damage.

Steps to Reproduce

Install any mod that uses that forge event and responds on empty hands and attempt to pick up a mob.

For instance, if you install tinkers and wear a tinkers chestplate, it will cause the mob to be punched.

Version of Minecraft, Carry On, Forge

  • Minecraft 1.18.2
  • Forge is 40.1.86
  • Carry On is 1.17.0.8
  • You can use Tinkers Construct 3.6.0.73 to reproduce this issue if you wish, though I expect other mods are affected

Screenshots encouraged

image

commented

Yes I agree that this is bad.
My reasoning for doing this in the first place was that mods around protections often have listeners for AttackEntityEvent and thus the pickup would be cancelled.
Do you have an idea for a different approach that would still achieve this compatibility?

commented

Any interaction based forge event is going to cause it to fire mod related hooks into that event, I don't see a free way to get compat. So just make it your own event, not extending any existing event.

Your best bet is tag blacklist and vanilla permissions APIs, if some mod needs a conditional blacklist they can use your event.

commented

Ok, I'll do that.