Posted June 5, 20223 yr Hello. 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 @SubscribeEvent 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"); } } @SubscribeEvent public void LivingAttackEvent(LivingEvent event) { // Will also lag in multiplayer even if its an empty function }
June 6, 20223 yr Author 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
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.