Package com.mrbysco.unhealthydying.util
Class UnhealthyHelper
java.lang.Object
com.mrbysco.unhealthydying.util.UnhealthyHelper
Helper class for the health modifier
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidchangeModifier(net.minecraft.world.entity.player.Player player, double modifierValue) Changes the modifier valuestatic net.minecraft.world.entity.ai.attributes.AttributeModifiergetModifier(double modifier) Gets the modifierstatic doublegetModifierForAmount(net.minecraft.world.entity.player.Player player, double healthWanted) Gets the modifier value required to reach the wanted healthstatic @Nullable ModifierWorldDatagetSavedData(net.minecraft.world.entity.player.Player player) Gets the saved datastatic voidinitializeModifier(net.minecraft.world.entity.player.Player player, double modifier) Initializes the modifierstatic doublesafetyCheck(net.minecraft.world.entity.player.Player player, double modifierValue) Checks if the modifier value is safe to applystatic voidsetEveryonesHealth(net.minecraft.world.entity.player.Player player, int changeModifier) Recalculate and set the health of everyonestatic voidsetEveryonesHealth(net.minecraft.world.entity.player.Player player, int changeModifier, boolean recalculate) Sets the health of everyonestatic voidsetHealth(net.minecraft.world.entity.player.Player player, int changeModifier) Recalculate and set the health of the playerstatic voidsetHealth(net.minecraft.world.entity.player.Player player, int changeModifier, boolean recalculate) Sets the health of the platerstatic voidsetScoreboardHealth(net.minecraft.world.entity.player.Player player, int changeModifier) Recalculate and set the health of the player based on the scoreboard teamstatic voidsetScoreboardHealth(net.minecraft.world.entity.player.Player player, int changeModifier, boolean recalculate) Sets the health of the player based on the scoreboard teamstatic voidsyncHealth(net.minecraft.world.entity.player.Player player) Syncs the health of the player with the saved data
-
Constructor Details
-
UnhealthyHelper
public UnhealthyHelper()
-
-
Method Details
-
initializeModifier
public static void initializeModifier(net.minecraft.world.entity.player.Player player, double modifier) Initializes the modifier- Parameters:
player- The player to initializemodifier- The modifier value
-
changeModifier
public static void changeModifier(net.minecraft.world.entity.player.Player player, double modifierValue) Changes the modifier value- Parameters:
player- The player to changemodifierValue- The amount to change the modifier with
-
getModifier
public static net.minecraft.world.entity.ai.attributes.AttributeModifier getModifier(double modifier) Gets the modifier- Parameters:
modifier- The modifier value- Returns:
- The modifier
-
getSavedData
@Nullable public static @Nullable ModifierWorldData getSavedData(net.minecraft.world.entity.player.Player player) Gets the saved data- Parameters:
player- The player who's world to get the data from- Returns:
- The saved data
-
setEveryonesHealth
public static void setEveryonesHealth(net.minecraft.world.entity.player.Player player, int changeModifier) Recalculate and set the health of everyone- Parameters:
player- The player to changechangeModifier- The amount to change the modifier with
-
setEveryonesHealth
public static void setEveryonesHealth(net.minecraft.world.entity.player.Player player, int changeModifier, boolean recalculate) Sets the health of everyone- Parameters:
player- The player to changechangeModifier- The amount to change the modifier withrecalculate- If the health modifier should be recalculated
-
setScoreboardHealth
public static void setScoreboardHealth(net.minecraft.world.entity.player.Player player, int changeModifier) Recalculate and set the health of the player based on the scoreboard team- Parameters:
player- The player to changechangeModifier- The amount to change the modifier with
-
setScoreboardHealth
public static void setScoreboardHealth(net.minecraft.world.entity.player.Player player, int changeModifier, boolean recalculate) Sets the health of the player based on the scoreboard team- Parameters:
player- The player to changechangeModifier- The amount to change the modifier withrecalculate- If the health modifier should be recalculated
-
setHealth
public static void setHealth(net.minecraft.world.entity.player.Player player, int changeModifier) Recalculate and set the health of the player- Parameters:
player- The player to changechangeModifier- The amount to change the modifier with
-
setHealth
public static void setHealth(net.minecraft.world.entity.player.Player player, int changeModifier, boolean recalculate) Sets the health of the plater- Parameters:
player- The player to changechangeModifier- The amount to change the modifier withrecalculate- If the health modifier should be recalculated
-
syncHealth
public static void syncHealth(net.minecraft.world.entity.player.Player player) Syncs the health of the player with the saved data- Parameters:
player- The player to sync
-
getModifierForAmount
public static double getModifierForAmount(net.minecraft.world.entity.player.Player player, double healthWanted) Gets the modifier value required to reach the wanted health- Parameters:
player- The player to checkhealthWanted- The health the player wants- Returns:
- The modifier value required to reach the wanted health
-
safetyCheck
public static double safetyCheck(net.minecraft.world.entity.player.Player player, double modifierValue) Checks if the modifier value is safe to apply- Parameters:
player- The player to checkmodifierValue- The modifier value to check- Returns:
- The modifier value that is safe to apply
-