Jump to content

Give LivingAttackEvent a result


Koward

Recommended Posts

Hello,

I would like to edit the way attack is done in EntityLivingBase#attackEntityFrom(DamageSource source, float amount).

I could cancel LivingAttackEvent and apply the effects myself, but obviously the return value of attackEntityFrom would always be false which could break many parts of the game.

If instead of always returning false, we could set the return value via a result of the event, it would allow us that kind of modification.

So, to quote the doc, instead of "If this event is canceled, the Entity does not take attack damage." it would be "If this event is canceled, no more computation is done. the Entity does not take attack damage. If the result is DENY, the Entity did not take attack damage". A DEFAULT to false would not break existing mods.

 

Edited by Koward
Link to comment
Share on other sites

I would like to change the base knockback applied when you punch a mob (without any item). There's no way to change that at the moment. I tried a work around applying a "reverse knockback", but has it depends on random values sometimes the knockback would still happen or only the reverse one, resulting in "pulling" the mob towards the player.

There are also other mechanics in this method that could be useful for some modders.

Edited by Koward
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.