Class DamageCause

java.lang.Object
com.hypixel.hytale.server.core.modules.entity.damage.DamageCause
All Implemented Interfaces:
JsonAsset<String>, JsonAssetWithMap<String, IndexedLookupTableAssetMap<String, DamageCause>>

public class DamageCause extends Object implements JsonAssetWithMap<String, IndexedLookupTableAssetMap<String, DamageCause>>
Represents a cause of damage in the game.
  • Field Details

  • Constructor Details

    • DamageCause

      public DamageCause()
      Empty Constructor for a DamageCause instance.

      Used by the codec to instantiate DamageCause instances.

    • DamageCause

      public DamageCause(@Nonnull String id)
      Constructor for a DamageCause instance.
      Parameters:
      id - The asset ID for this damage cause.
    • DamageCause

      public DamageCause(@Nonnull String id, @Nonnull String inherits, boolean durabilityLoss, boolean staminaLoss, boolean bypassResistances)
      Default Constructor for a DamageCause instance.
      Parameters:
      id - The asset ID for this damage cause.
      inherits - The id of the damage cause this one inherits from.
      durabilityLoss - Whether this damage cause causes durability loss.
      staminaLoss - Whether this damage cause causes stamina loss.
      bypassResistances - Whether this damage cause bypasses resistances.
  • Method Details

    • getAssetStore

      @Nonnull public static AssetStore<String, DamageCause, IndexedLookupTableAssetMap<String, DamageCause>> getAssetStore()
      Returns:
      the asset store for damage causes.
    • getAssetMap

      @Nonnull public static IndexedLookupTableAssetMap<String, DamageCause> getAssetMap()
      Returns:
      the asset map for damage causes.
    • getId

      public String getId()
      Specified by:
      getId in interface JsonAsset<String>
    • isDurabilityLoss

      public boolean isDurabilityLoss()
      Returns:
      true if this damage cause causes durability loss, false otherwise.
    • isStaminaLoss

      public boolean isStaminaLoss()
      Returns:
      true if this damage cause causes stamina loss, false otherwise.
    • doesBypassResistances

      public boolean doesBypassResistances()
      Returns:
      true if this damage cause bypasses resistances, false otherwise.
    • getInherits

      public String getInherits()
      Returns:
      the color of the damage text.
    • getAnimationId

      public String getAnimationId()
      Returns:
      the color of the damage text.
    • getDeathAnimationId

      public String getDeathAnimationId()
      Returns:
      the color of the damage text.
    • getDeathMessageKey

      @Nullable public String getDeathMessageKey()
      Returns:
      the localization key used on the death screen when this damage cause kills a player.
    • resolveDamageTextColor

      @Nullable public Color resolveDamageTextColor()
      Returns:
      the parsed damage text color of this cause, falling back through the Inherits chain, or null when no cause in the chain declares one.
    • isOrInherits

      public boolean isOrInherits(@Nonnull DamageCause ancestor)
      Returns:
      true if this damage cause is ancestor or inherits from it, false otherwise.
    • toPacket

      @Nonnull public DamageCause toPacket()