Jump to content

[solved] override attackEntityFrom for vanilla mobs?


Recommended Posts

I have some custom mobs and custom weapons with custom damage sources  ;)


It's straight forward to have my own entities reacted to those custom damage sources because I can put whatever I please into attackEntityFrom().  Is there a straight forward way to do that for vanilla entities?



Link to comment
Share on other sites

Thanks for the response.  I did look at LivingAttackEvent but didn't see a straight forward way to persist anything, like a state of frozen  What I'm doing on my custom entities is within attackEntityFrom() I check the damagesource to see if it's an iceblast then set the entity's state to frozen.  During the onUpdate() for that entity, if it's frozen, it does nothing.


I looked at using LivingAttackEvent, tracking a collection of entities that were hit with an iceblast and referencing them in a LivingUpdateEvent handler to freeze them, but it felt like overkill.  Often when my solutions go out of the way, I'm approaching it wrong.  :(

Link to comment
Share on other sites

Do you want them to look frozen or such?


You could remove the entity, replace it with a icicle version of the entity, have that entity respawn the original when it times out.  That would be a cool effect.


Other than that, you would have to track all the entities, spam zero motion and set position to origin position, set agrotarget to null, and cancel every entityagro event at a minimum.


I think replacing the entiry temporarily would be a more robust solution and easier to troubleshoot long term, but that is just me.

Long time Bukkit & Forge Programmer

Happy to try and help

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.

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.


  • Create New...

Important Information

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