Interface DamageSourceFactory
public interface DamageSourceFactory
Creates damage sources.
Obtained from CombatService.sources().
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptionReturns a source for an arrow hit.at(TypedKey<DamageType> type, Location position) Returns a source for damage radiating from a point, such as an explosion.cactus()Returns a source for damage dealt by touching a cactus.drown()Returns a source for damage dealt by drowning.fall()Returns a source for damage dealt by falling.freeze()Returns a source for damage dealt by freezing, as in powder snow or under the Freezing effect.generic()Returns a source for damage dealt by an unspecified cause.Returns a source that kills whatever it hits, as/killdoes.inFire()Returns a source for damage dealt by standing in fire.lava()Returns a source for damage dealt by standing in lava.maceSmash(LivingEntity attacker) Returns a source for a smash attack of a mace.magic()Returns a source for damage dealt by a magic effect, such as Poison or Instant Damage.mobAttack(@Nullable LivingEntity attacker) Returns a source for a melee hit of a mob, dealt with the item in its main hand.of(TypedKey<DamageType> type) Returns an environmental source with no entity attached.of(TypedKey<DamageType> type, @Nullable Entity source) Returns a source caused and dealt by the same entity.Returns a source whose credited entity differs from the one that touched the victim.onFire()Returns a source for damage dealt by burning.Returns a source for damage dealt by falling out of the world.playerAttack(Player attacker) Returns a source for a melee hit of a player, dealt with the item in their main hand.starve()Returns a source for damage dealt by starving.Returns a source for the damage Thorns deals back.Returns a source for a thrown projectile, such as a snowball or an ice ball.Returns a source for a thrown trident hit.wither()Returns a source for damage dealt by the Wither effect.
-
Method Details
-
of
Returns an environmental source with no entity attached.- Parameters:
type- theminecraft:damage_typeto 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- theminecraft:damage_typeto report to the clientsource- the entity responsible for the hit, ornull- 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- theminecraft:damage_typeto report to the clientcausing- the entity credited with the kill, typically the shooterdirect- 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
Returns a source for damage radiating from a point, such as an explosion.- Parameters:
type- theminecraft:damage_typeto report to the clientposition- the point the damage radiated from- Returns:
- a source for damage radiating from a point, such as an explosion
- Since:
- 0.1.0
-
playerAttack
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
Returns a source for a melee hit of a mob, dealt with the item in its main hand.- Parameters:
attacker- the attacking mob, ornull- Returns:
- a source for a melee hit of a mob, dealt with the item in its main hand
- Since:
- 0.1.0
-
arrow
Returns a source for an arrow hit.- Parameters:
arrow- the arrowshooter- the entity that shot it, ornull- Returns:
- a source for an arrow hit
- Since:
- 0.1.0
-
trident
Returns a source for a thrown trident hit.- Parameters:
trident- the tridentthrower- the entity that threw it, ornull- Returns:
- a source for a thrown trident hit
- Since:
- 0.1.0
-
maceSmash
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
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
Returns a source for a thrown projectile, such as a snowball or an ice ball.- Parameters:
projectile- the projectile that hit, ornullif it is unknownthrower- the entity that threw it, ornullif 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/killdoes.- Returns:
- a source that kills whatever it hits, as
/killdoes - Since:
- 0.1.0
-