Interface DamageSourceFactory


public interface DamageSourceFactory
Creates damage sources.

Obtained from CombatService.sources().

Since:
0.1.0
  • Method Details

    • of

      Returns an environmental source with no entity attached.
      Parameters:
      type - the minecraft:damage_type to report to the client
      Returns:
      an environmental source with no entity attached
      Since:
      0.1.0
    • of

      Returns a source caused and dealt by the same entity.
      Parameters:
      type - the minecraft:damage_type to report to the client
      source - the entity responsible for the hit, or null
      Returns:
      a source caused and dealt by the same entity
      Since:
      0.1.0
    • of

      Returns a source whose credited entity differs from the one that touched the victim.
      Parameters:
      type - the minecraft:damage_type to report to the client
      causing - the entity credited with the kill, typically the shooter
      direct - the entity that physically hit the victim, typically the projectile
      Returns:
      a source whose credited entity differs from the one that touched the victim
      Since:
      0.1.0
    • at

      DamageSource at(TypedKey<DamageType> type, Location position)
      Returns a source for damage radiating from a point, such as an explosion.
      Parameters:
      type - the minecraft:damage_type to report to the client
      position - the point the damage radiated from
      Returns:
      a source for damage radiating from a point, such as an explosion
      Since:
      0.1.0
    • playerAttack

      DamageSource playerAttack(Player attacker)
      Returns a source for a melee hit of a player, dealt with the item in their main hand.
      Parameters:
      attacker - the attacking player
      Returns:
      a source for a melee hit of a player, dealt with the item in their main hand
      Since:
      0.1.0
    • mobAttack

      DamageSource mobAttack(@Nullable LivingEntity attacker)
      Returns a source for a melee hit of a mob, dealt with the item in its main hand.
      Parameters:
      attacker - the attacking mob, or null
      Returns:
      a source for a melee hit of a mob, dealt with the item in its main hand
      Since:
      0.1.0
    • arrow

      DamageSource arrow(Entity arrow, @Nullable Entity shooter)
      Returns a source for an arrow hit.
      Parameters:
      arrow - the arrow
      shooter - the entity that shot it, or null
      Returns:
      a source for an arrow hit
      Since:
      0.1.0
    • trident

      DamageSource trident(Entity trident, @Nullable Entity thrower)
      Returns a source for a thrown trident hit.
      Parameters:
      trident - the trident
      thrower - the entity that threw it, or null
      Returns:
      a source for a thrown trident hit
      Since:
      0.1.0
    • maceSmash

      DamageSource maceSmash(LivingEntity attacker)
      Returns a source for a smash attack of a mace.
      Parameters:
      attacker - the attacking entity
      Returns:
      a source for a smash attack of a mace
      Since:
      0.1.0
    • thorns

      DamageSource thorns(Entity wearer)
      Returns a source for the damage Thorns deals back.
      Parameters:
      wearer - the entity wearing the thorny armor
      Returns:
      a source for the damage Thorns deals back
      Since:
      0.1.0
    • thrown

      DamageSource thrown(@Nullable Entity projectile, @Nullable Entity thrower)
      Returns a source for a thrown projectile, such as a snowball or an ice ball.
      Parameters:
      projectile - the projectile that hit, or null if it is unknown
      thrower - the entity that threw it, or null if there is none
      Returns:
      a source for a thrown projectile, such as a snowball or an ice ball
      Since:
      0.1.0
    • fall

      DamageSource fall()
      Returns a source for damage dealt by falling.
      Returns:
      a source for damage dealt by falling
      Since:
      0.1.0
    • drown

      DamageSource drown()
      Returns a source for damage dealt by drowning.
      Returns:
      a source for damage dealt by drowning
      Since:
      0.1.0
    • lava

      DamageSource lava()
      Returns a source for damage dealt by standing in lava.
      Returns:
      a source for damage dealt by standing in lava
      Since:
      0.1.0
    • inFire

      DamageSource inFire()
      Returns a source for damage dealt by standing in fire.
      Returns:
      a source for damage dealt by standing in fire
      Since:
      0.1.0
    • onFire

      DamageSource onFire()
      Returns a source for damage dealt by burning.
      Returns:
      a source for damage dealt by burning
      Since:
      0.1.0
    • cactus

      DamageSource cactus()
      Returns a source for damage dealt by touching a cactus.
      Returns:
      a source for damage dealt by touching a cactus
      Since:
      0.1.0
    • starve

      DamageSource starve()
      Returns a source for damage dealt by starving.
      Returns:
      a source for damage dealt by starving
      Since:
      0.1.0
    • outOfWorld

      DamageSource outOfWorld()
      Returns a source for damage dealt by falling out of the world.
      Returns:
      a source for damage dealt by falling out of the world
      Since:
      0.1.0
    • freeze

      DamageSource freeze()
      Returns a source for damage dealt by freezing, as in powder snow or under the Freezing effect.
      Returns:
      a source for damage dealt by freezing, as in powder snow or under the Freezing effect
      Since:
      0.1.0
    • magic

      DamageSource magic()
      Returns a source for damage dealt by a magic effect, such as Poison or Instant Damage.
      Returns:
      a source for damage dealt by a magic effect, such as Poison or Instant Damage
      Since:
      0.1.0
    • wither

      DamageSource wither()
      Returns a source for damage dealt by the Wither effect.
      Returns:
      a source for damage dealt by the Wither effect
      Since:
      0.1.0
    • generic

      DamageSource generic()
      Returns a source for damage dealt by an unspecified cause.
      Returns:
      a source for damage dealt by an unspecified cause
      Since:
      0.1.0
    • genericKill

      DamageSource genericKill()
      Returns a source that kills whatever it hits, as /kill does.
      Returns:
      a source that kills whatever it hits, as /kill does
      Since:
      0.1.0