Skip to content

DamageCause

Package: com.hypixel.hytale.server.core.modules.entity.damage

public class DamageCause implements JsonAssetWithMap<String, IndexedLookupTableAssetMap<String, DamageCause>>

A JSON-driven asset defining a type of damage (physical, projectile, fall, drowning, etc.). Loaded from data files and indexed in an IndexedLookupTableAssetMap. Each cause can inherit from a parent cause, and controls properties such as whether it triggers durability loss, stamina loss, and whether it bypasses armor resistances. Also carries animation IDs for hurt and death animations.

These legacy constants reference well-known damage cause instances. They are deprecated in favor of index-based asset lookups.

ConstantDescription
PHYSICALMelee physical damage.
PROJECTILERanged projectile damage.
COMMANDDamage from a server command.
DROWNINGDamage from being submerged without oxygen.
ENVIRONMENTDamage from environmental hazards.
FALLDamage from falling.
OUT_OF_WORLDDamage from being below the world boundary.
SUFFOCATIONDamage from being inside a solid block.
@Nonnull
public static AssetStore<String, DamageCause, IndexedLookupTableAssetMap<String, DamageCause>> getAssetStore()

Returns the asset store containing all registered DamageCause instances. Lazily initialized from the AssetRegistry.

@Nonnull
public static IndexedLookupTableAssetMap<String, DamageCause> getAssetMap()

Returns the indexed lookup table for efficient integer-indexed access to damage causes.

public DamageCause()

Default constructor for codec deserialization.

public DamageCause(@Nonnull String id)

Creates a damage cause with the given string identifier.

public DamageCause(@Nonnull String id, @Nonnull String inherits, boolean durabilityLoss, boolean staminaLoss, boolean bypassResistances)

Creates a fully specified damage cause.

public String getId()

Returns the string identifier for this damage cause.

public boolean isDurabilityLoss()

Returns true if this damage cause triggers durability loss on armor and weapons.

public boolean isStaminaLoss()

Returns true if this damage cause triggers stamina loss.

public boolean doesBypassResistances()

Returns true if this damage cause bypasses armor damage resistances.

public String getInherits()

Returns the parent damage cause identifier, or null if this cause has no parent. Used for resistance inheritance chains.

public String getAnimationId()

Returns the hurt animation identifier. Defaults to "Hurt".

public String getDeathAnimationId()

Returns the death animation identifier. Defaults to "Death".

@Nonnull
public com.hypixel.hytale.protocol.DamageCause toPacket()

Converts this damage cause to a protocol packet representation containing the ID and damage text color.

JSON KeyTypeDescription
InheritsStringParent damage cause ID for resistance inheritance.
DurabilityLossbooleanWhether this cause triggers item durability loss.
StaminaLossbooleanWhether this cause triggers stamina loss.
BypassResistancesbooleanWhether this cause bypasses armor resistances.
DamageTextColorStringColor for combat text display.
AnimationIdStringHurt animation ID.
DeathAnimationIdStringDeath animation ID.
Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.