Updating tab health

Discussion in 'Plugin Development' started by Ak1ra, Feb 4, 2025.

  1. Offline

    Ak1ra

    I am making a plugin using scoreboards, I want the fancy hearts in the tab list using this:

    Objective hearts = sb.registerNewObjective("hearts",Criteria.HEALTH,"hp",RenderType.HEARTS);

    unfortunately, the hearts are gone until the player gets damaged. I tried what I saw in other threads like
    p.setHealth(p.getHealth()); or
    p.sendHealthUpdate();
    but none of these make a difference. Is there a way to show the health right after setting the scoreboard?
     
  2. Offline

    Zombie_Striker

    @Ak1ra
    I have not done testing in this, but I assume the client only renders the hearts if the score is not 20 (i.e not full health).

    If it renders if a player is damaged and then gets healed, set health to 19 (9.5 hearts) for 1 tick before setting it back to 20. That should be a hacky fix to counter minecraft's hackiness.
     

Share This Page