NaN Health Fixer

NaN Health Fixer

2M Downloads

NaN doesn't change

MindOfEmi opened this issue ยท 0 comments

commented

I created a similar Mod in fabric for me and my friend but it doesn't work. My code sets the player health to 0 when they join (for testing) but when I change the Player NBT-Data to NaN the mod says the the player has 20 HP and it doesn't change the players health. What did I do wrong? The Mod is Fabric and the MC Version is 1.20.1. This is the code:

public class JoinHandler implements ClientPlayConnectionEvents.Join{
    @Override
    public void onPlayReady(ClientPlayNetworkHandler handler, PacketSender sender, MinecraftClient client) {
        if (client.player == null) return;

        client.player.sendMessage(
                Text.literal(String.valueOf(client.player.getHealth()))
        );

        client.player.setHealth(0.0f);
    }
}