Jump to content

Getting the potion effects of Entities that are not the player


ZDoctor

Recommended Posts

I would like to get the current active potion effects of a living entity that is not the player. Ideally, this would be on the client side only needing no assistance from the server using what is available.

 

As far as I can tell and from what I tested, with the exception of the player, when a potion effect is added to an entity it is not updated to the client. The color of the particles as I can tell are stored in the POTION_EFFECTS, but not what type of effect they are. That is why the particles still spawn even if the client does not know what active effects are on the entity.

 

Here is something interesting, I noticed that since the potion effects are written to the nbt, when the world is reloaded, if a potion effect was active, then the client becomes aware of that effect. However, that effect is not removed and remains in the active potion map until next reload.

Link to comment
Share on other sites

As you've said yourself the client doesn't know of potion effects applied to an entity. You will need to send them to the client yourself. Probably you would compare the current effects to the effects active last tick and send the data to the client when there is a new effect added/old effect removed/effect changed.

Link to comment
Share on other sites

Yeah, I was afraid of that. I tried pushing a fix, but it wasn't well received due to how it affected the patch file. It's too bad, I was hoping there was another way besides my patch. I made a pretty cool damage indicator above anything living that would show the status icons and the hearts would render just like a player's (animated and everything). It's pretty cool.2018-09-14_13_23_35.thumb.png.7583d1f4cabf400bbee052f804474a7e.png

 

Now if I want it to work like that I would need to learn to edit the files, probably with asm, and even then it would only work like that in single player mod unless the server had the same mod. :( I guess it would be an interesting skill to have.

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.