net.minecraft.util

## Class DamageSource

- java.lang.Object
- - net.minecraft.util.DamageSource

- Direct Known Subclasses:
    EntityDamageSource

      public class DamageSource
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static DamageSource` | `anvil`
    `static DamageSource` | `cactus`
    `String` | `damageType`
    `static DamageSource` | `drown`
    `static DamageSource` | `fall`
    `static DamageSource` | `fallingBlock`
    `static DamageSource` | `generic`
    `static DamageSource` | `inFire`
    `static DamageSource` | `inWall`
    `static DamageSource` | `lava`
    `static DamageSource` | `magic`
    `static DamageSource` | `onFire`
    `static DamageSource` | `outOfWorld`
    `static DamageSource` | `starve`
    `static DamageSource` | `wither`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canHarmInCreative()`
    `static DamageSource` | `causeArrowDamage(EntityArrow par0EntityArrow, Entity par1Entity)` returns EntityDamageSourceIndirect of an arrow
    `static DamageSource` | `causeFireballDamage(EntityFireball par0EntityFireball, Entity par1Entity)` returns EntityDamageSourceIndirect of a fireball
    `static DamageSource` | `causeIndirectMagicDamage(Entity par0Entity, Entity par1Entity)`
    `static DamageSource` | `causeMobDamage(EntityLivingBase par0EntityLivingBase)`
    `static DamageSource` | `causePlayerDamage(EntityPlayer par0EntityPlayer)` returns an EntityDamageSource of type player
    `static DamageSource` | `causeThornsDamage(Entity par0Entity)` Returns the EntityDamageSource of the Thorns enchantment
    `static DamageSource` | `causeThrownDamage(Entity par0Entity, Entity par1Entity)`
    `String` | `getDamageType()` Return the name of damage type.
    `ChatMessageComponent` | `getDeathMessage(EntityLivingBase par1EntityLivingBase)` Returns the message to be displayed on player death.
    `Entity` | `getEntity()`
    `float` | `getHungerDamage()` How much satiate(food) is consumed by this DamageSource
    `Entity` | `getSourceOfDamage()`
    `boolean` | `isDifficultyScaled()` Return whether this damage source will have its damage amount scaled based on the current difficulty.
    `boolean` | `isExplosion()`
    `boolean` | `isFireDamage()` Returns true if the damage is fire based.
    `boolean` | `isMagicDamage()` Returns true if the damage is magic based.
    `boolean` | `isProjectile()` Returns true if the damage is projectile based.
    `boolean` | `isUnblockable()`
    `DamageSource` | `setDifficultyScaled()` Set whether this damage source will have its damage amount scaled based on the current difficulty.
    `DamageSource` | `setExplosion()`
    `static DamageSource` | `setExplosionSource(Explosion par0Explosion)`
    `DamageSource` | `setMagicDamage()` Define the damage type as magic based.
    `DamageSource` | `setProjectile()` Define the damage type as projectile based.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### inFire

          public static DamageSource inFire

    - #### onFire

          public static DamageSource onFire

    - #### lava

          public static DamageSource lava

    - #### inWall

          public static DamageSource inWall

    - #### drown

          public static DamageSource drown

    - #### starve

          public static DamageSource starve

    - #### cactus

          public static DamageSource cactus

    - #### fall

          public static DamageSource fall

    - #### outOfWorld

          public static DamageSource outOfWorld

    - #### generic

          public static DamageSource generic

    - #### magic

          public static DamageSource magic

    - #### wither

          public static DamageSource wither

    - #### anvil

          public static DamageSource anvil

    - #### fallingBlock

          public static DamageSource fallingBlock

    - #### damageType

          public String damageType

  - ### Method Detail

    - #### causeMobDamage

          public static DamageSource causeMobDamage(EntityLivingBase par0EntityLivingBase)

    - #### causePlayerDamage

          public static DamageSource causePlayerDamage(EntityPlayer par0EntityPlayer)

      returns an EntityDamageSource of type player

    - #### causeArrowDamage

          public static DamageSource causeArrowDamage(EntityArrow par0EntityArrow,
                                      Entity par1Entity)

      returns EntityDamageSourceIndirect of an arrow

    - #### causeFireballDamage

          public static DamageSource causeFireballDamage(EntityFireball par0EntityFireball,
                                         Entity par1Entity)

      returns EntityDamageSourceIndirect of a fireball

    - #### causeThrownDamage

          public static DamageSource causeThrownDamage(Entity par0Entity,
                                       Entity par1Entity)

    - #### causeIndirectMagicDamage

          public static DamageSource causeIndirectMagicDamage(Entity par0Entity,
                                              Entity par1Entity)

    - #### causeThornsDamage

          public static DamageSource causeThornsDamage(Entity par0Entity)

      Returns the EntityDamageSource of the Thorns enchantment

    - #### setExplosionSource

          public static DamageSource setExplosionSource(Explosion par0Explosion)

    - #### isProjectile

          public boolean isProjectile()

      Returns true if the damage is projectile based.

    - #### setProjectile

          public DamageSource setProjectile()

      Define the damage type as projectile based.

    - #### isExplosion

          public boolean isExplosion()

    - #### setExplosion

          public DamageSource setExplosion()

    - #### isUnblockable

          public boolean isUnblockable()

    - #### getHungerDamage

          public float getHungerDamage()

      How much satiate(food) is consumed by this DamageSource

    - #### canHarmInCreative

          public boolean canHarmInCreative()

    - #### getSourceOfDamage

          public Entity getSourceOfDamage()

    - #### getEntity

          public Entity getEntity()

    - #### getDeathMessage

          public ChatMessageComponent getDeathMessage(EntityLivingBase par1EntityLivingBase)

      Returns the message to be displayed on player death.

    - #### isFireDamage

          public boolean isFireDamage()

      Returns true if the damage is fire based.

    - #### getDamageType

          public String getDamageType()

      Return the name of damage type.

    - #### setDifficultyScaled

          public DamageSource setDifficultyScaled()

      Set whether this damage source will have its damage amount scaled based on the current difficulty.

    - #### isDifficultyScaled

          public boolean isDifficultyScaled()

      Return whether this damage source will have its damage amount scaled based on the current difficulty.

    - #### isMagicDamage

          public boolean isMagicDamage()

      Returns true if the damage is magic based.

    - #### setMagicDamage

          public DamageSource setMagicDamage()

      Define the damage type as magic based.