Posted May 7, 20169 yr 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.
May 7, 20169 yr 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. 1.7.10 is no longer supported by forge, you are on your own.
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.