When I Do getMaxHealth() and it ends up to be 20 but there's actually 10 heart in game how do i make 20 to 10?
From the Minecraft Wiki: In other words, each full heart represents 2 health points. That means that a half heart is worth 1 health point. If you really want to turn health into a floating point number, you can simply divide the result by 2, but I'm guessing that's not what you really want.