Class UnhealthyHelper

java.lang.Object
com.mrbysco.unhealthydying.util.UnhealthyHelper

public class UnhealthyHelper extends Object
Helper class for the health modifier
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    changeModifier(net.minecraft.world.entity.player.Player player, double modifierValue)
    Changes the modifier value
    static net.minecraft.world.entity.ai.attributes.AttributeModifier
    getModifier(double modifier)
    Gets the modifier
    static double
    getModifierForAmount(net.minecraft.world.entity.player.Player player, double healthWanted)
    Gets the modifier value required to reach the wanted health
    static @Nullable ModifierWorldData
    getSavedData(net.minecraft.world.entity.player.Player player)
    Gets the saved data
    static void
    initializeModifier(net.minecraft.world.entity.player.Player player, double modifier)
    Initializes the modifier
    static double
    safetyCheck(net.minecraft.world.entity.player.Player player, double modifierValue)
    Checks if the modifier value is safe to apply
    static void
    setEveryonesHealth(net.minecraft.world.entity.player.Player player, int changeModifier)
    Recalculate and set the health of everyone
    static void
    setEveryonesHealth(net.minecraft.world.entity.player.Player player, int changeModifier, boolean recalculate)
    Sets the health of everyone
    static void
    setHealth(net.minecraft.world.entity.player.Player player, int changeModifier)
    Recalculate and set the health of the player
    static void
    setHealth(net.minecraft.world.entity.player.Player player, int changeModifier, boolean recalculate)
    Sets the health of the plater
    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
    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
    static void
    syncHealth(net.minecraft.world.entity.player.Player player)
    Syncs the health of the player with the saved data

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 initialize
      modifier - 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 change
      modifierValue - 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 change
      changeModifier - 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 change
      changeModifier - The amount to change the modifier with
      recalculate - 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 change
      changeModifier - 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 change
      changeModifier - The amount to change the modifier with
      recalculate - 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 change
      changeModifier - 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 change
      changeModifier - The amount to change the modifier with
      recalculate - 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 check
      healthWanted - 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 check
      modifierValue - The modifier value to check
      Returns:
      The modifier value that is safe to apply