Jump to content

[1.9] Confusion about client and server events


Recommended Posts

Hey guys, so i'm totally new to Forge API and would love guidance. (I come from a Bukkit background). I am looking to make a client mod where when a player takes damage (on a vanilla/spigot - not forge - server), x code happens. I have some sample code, and have registered the LivingHurtEvent event. However, on multiplayer the event does not seem to fire, ever. Can anyone point me in the right direction? Cheers.

Link to comment
Share on other sites

LivingHurtEvent is fired only by server to compute how much damage should be dealt to entity after attack has succesfully reached "damaging point" (e.g entity is not invulnerable).


Client side is only ever notified about health, but never about hurting itself, therefore - you cannot track hurting on client easily.


Without either server telling you it happened (not possible on client-only mods) or finding it on your own (making some tick-based event that check difference between prev and current health), it is not really possible to do it nicely.


I am not sure about colored statement tho, but I am sure about HurtEvent.


There is also LivingAttackEvent which (I think) is fired on client, BUT - this one (if fired) would be called BEFORE server's, so kinda like:

client attack -> packet to server -> server attack -> server hurt -> damage dealth -> client update with new health.


Again, I am not really sure about this one (been months since I touched those events).

I recommend testing. :D

1.7.10 is no longer supported by forge, you are on your own.

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.