Jump to content

Client-side LivingHurtEvent alternative


Lagg

Recommended Posts

I'm making a client-side hud mod that I want to tell me the last person that hit me, but I'm not sure how to go about it. The LivingHurtEvent has this info, but it's only server side :(, so I'm trying to find an alternative that's client side.

 

I read a thread about something similar to this, where it was suggested the original poster either check every tick if the player's health decreases or look around for a packet that sends that info. 

 

Checking if my player's health is decreasing won't tell me what hit me, but I was wondering if anybody knew if any packets used this info - I've looked around but I'm still a little confused how to read what these packets do.

 

Alternatively, if that packet doesn't exist, how should i go about checking my surroundings for what hurt me?

 

Any advice is appreciated, thanks :)

Hi

:D

Link to comment
Share on other sites

I'm not certain but the combat tracker might be up to date on the client side. Each entity living base child class has a combat tracker that indicates what is attacking and what the damage source is. So you can call the getCombatTracker() on the player entity and then get further info such as the damage source and attacker. I guess you'd do it in the Player tick event.

 

Also, if you can't figure out an easier way, you can have the server side send a custom packet to the client with the info you need.

  • Like 1

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.