Posted January 23, 20205 yr I want to set player's max health to 20.0. I have managed to increase health by 10.0. But every time this function is called, the player's health keeps increase. How do max health set? public static void setPlayerHealth(PlayerEntity player) { player.getAttribute(SharedMonsterAttributes.MAX_HEALTH).applyModifier(new AttributeModifier("MaxHealth", 10.0f, AttributeModifier.Operation.ADDITION)); player.setHealth(20.0f); } Edited January 24, 20205 yr by kyazuki
January 24, 20205 yr Author I want to call this function when player logins first or every time player dies.
January 24, 20205 yr Author Yes, I call this function on those events. But those events happens not only once, health keeps increase.
January 24, 20205 yr Author I gradually decrease max health on PlayerTickEvent. If a player dies, reset his max health to 20 hearts. But this cord increases max health every time he dies. How do I reset his max health?
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.