Jump to content

[1.16.5] EntityAttributeCreationEvent with config values?


Recommended Posts

Moving forward, GlobalEntityTypeAttributes.put() is being deprecated in favor of the EntityAttributeCreationEvent. However, my mobs use config values for attributes like max health and the new event fires before the configs are loaded, which causes all the attributes to use their default values. I found EntityAttributeModificationEvent but even that fires before configs. Is there any way to do this with the new event?

Link to comment
Share on other sites

48 minutes ago, diesieben07 said:

TL;DR: You can't.

Configuration of attribute values should probably be done with attribute modifiers instead of modifying the base value. In your Entity constructor you can use ModifiableAttributeInstance#addTransientModifier to add any modifiers that are configured via the config (it won't persist to disk, because its transient).

Ah, wasn't aware of this method. Thank you!

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.