Jump to content

onLivingHurt cause lag in multiplayer


Recommended Posts


I am trying to build a mod that shows target health when shooting it with arrow.

And it works fine in singleplayer but very laggy in multiplayer (Even if I join a small server).

Events I used: onLivingHurt, LivingAttackEvent, LivingDamageEvent (There are all lagging in multiplayer)


NOTE: even if I delete all the code inside the function it will also still laggy


    public void onLivingHurt(LivingHurtEvent event){
        if (event.getSource().isProjectile()) {
            // Get attacker name
            EntityPlayerMP attacker = (EntityPlayerMP) event.getSource().getTrueSource();
            String attackerName = attacker.getDisplayNameString();

            // Damage dealt
            float damage = event.getAmount();

            // Get target info
            String targetName = event.getEntity().getName();
            float targetHealth = event.getEntityLiving().getHealth();

            Chat.SendMessage("Shot: " + targetName + " | Damage: " + damage + " | HealthB4: " + targetHealth + " | HealthAFTR: " + (targetHealth - damage), "green");


    public void LivingAttackEvent(LivingEvent event) {
        // Will also lag in multiplayer even if its an empty function


Link to comment
Share on other sites

9 hours ago, diesieben07 said:

That is highly unlikely.

However note that subscribing to LivingEvent (not LivingHurtEvent) achieves no useful results.

Then what event i should use ?

I want event that gets target name and health (that has been shot by player projectile/arrow

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.