DamageSource

Importing the class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

script.zs
import crafttweaker.api.world.DamageSource;

Static Methods

Return Type: DamageSource

script.zs
DamageSource.arrow(arrow as Arrow, owner as Entity?) as DamageSource
ParameterType
Parameter
arrow
Type
Arrow
Parameter
owner
Type
Entity?

Return Type: DamageSource

script.zs
// DamageSource.badRespawnPointExplosion() as DamageSource
DamageSource.badRespawnPointExplosion();

Return Type: DamageSource

script.zs
DamageSource.explosion(explosion as Explosion?) as DamageSource
ParameterType
Parameter
explosion
Type
Explosion?

Return Type: DamageSource

script.zs
DamageSource.explosion(owner as LivingEntity?) as DamageSource
ParameterTypeOptional
Parameter
owner
Type
LivingEntity?
Optional
true

Return Type: DamageSource

script.zs
DamageSource.fireball(fireball as Fireball, owner as Entity?) as DamageSource
ParameterType
Parameter
fireball
Type
Fireball
Parameter
owner
Type
Entity?

Return Type: DamageSource

script.zs
DamageSource.fireworks(entity as FireworkRocketEntity, owner as Entity?) as DamageSource
ParameterType
Parameter
entity
Type
FireworkRocketEntity
Parameter
owner
Type
Entity?

Return Type: DamageSource

script.zs
DamageSource.indirectMagic(entity as Entity, owner as Entity?) as DamageSource
ParameterType
Parameter
entity
Type
Entity
Parameter
owner
Type
Entity?

Return Type: DamageSource

script.zs
DamageSource.indirectMobAttack(entity as Entity, owner as LivingEntity?) as DamageSource
ParameterType
Parameter
entity
Type
Entity
Parameter
owner
Type
LivingEntity?

Return Type: DamageSource

script.zs
DamageSource.mobAttack(living as LivingEntity) as DamageSource
ParameterType
Parameter
living
Type
LivingEntity

Return Type: DamageSource

script.zs
DamageSource.playerAttack(player as Player) as DamageSource
ParameterType
Parameter
player
Type
Player

Return Type: DamageSource

script.zs
DamageSource.string(living as LivingEntity) as DamageSource
ParameterType
Parameter
living
Type
LivingEntity

Return Type: DamageSource

script.zs
DamageSource.thorns(entity as Entity) as DamageSource
ParameterType
Parameter
entity
Type
Entity

Return Type: DamageSource

script.zs
DamageSource.thrown(entity as Entity, owner as Entity?) as DamageSource
ParameterType
Parameter
entity
Type
Entity
Parameter
owner
Type
Entity?

Return Type: DamageSource

script.zs
DamageSource.trident(entity as Entity, owner as Entity?) as DamageSource
ParameterType
Parameter
entity
Type
Entity
Parameter
owner
Type
Entity?

Return Type: DamageSource

script.zs
DamageSource.witherSkull(witherSkull as WitherSkull, owner as Entity?) as DamageSource
ParameterType
Parameter
witherSkull
Type
WitherSkull
Parameter
owner
Type
Entity?

Methods

Return Type: Entity?

script.zs
// DamageSource.getDirectEntity() as Entity?
myDamageSource.getDirectEntity();

Return Type: Entity?

script.zs
// DamageSource.getEntity() as Entity?
myDamageSource.getEntity();

Return Type: float

script.zs
// DamageSource.getFoodExhaustion() as float
myDamageSource.getFoodExhaustion();

Return Type: Component

script.zs
DamageSource.getLocalizedDeathMessage(entity as LivingEntity) as Component
ParameterType
Parameter
entity
Type
LivingEntity

Return Type: string

script.zs
// DamageSource.getMsgId() as string
myDamageSource.getMsgId();

Return Type: Vec3?

script.zs
// DamageSource.getSourcePosition() as Vec3?
myDamageSource.getSourcePosition();

Return Type: boolean

script.zs
// DamageSource.isBypassArmor() as boolean
myDamageSource.isBypassArmor();

Return Type: boolean

script.zs
// DamageSource.isBypassInvul() as boolean
myDamageSource.isBypassInvul();

Return Type: boolean

script.zs
// DamageSource.isBypassMagic() as boolean
myDamageSource.isBypassMagic();

Return Type: boolean

script.zs
// DamageSource.isCreativePlayer() as boolean
myDamageSource.isCreativePlayer();

Return Type: boolean

script.zs
// DamageSource.isDamageHelmet() as boolean
myDamageSource.isDamageHelmet();

Return Type: boolean

script.zs
// DamageSource.isExplosion() as boolean
myDamageSource.isExplosion();

Return Type: boolean

script.zs
// DamageSource.isFall() as boolean
myDamageSource.isFall();

Return Type: boolean

script.zs
// DamageSource.isFire() as boolean
myDamageSource.isFire();

Return Type: boolean

script.zs
// DamageSource.isMagic() as boolean
myDamageSource.isMagic();

Return Type: boolean

script.zs
// DamageSource.isNoAggro() as boolean
myDamageSource.isNoAggro();

Return Type: boolean

script.zs
// DamageSource.isProjectile() as boolean
myDamageSource.isProjectile();

Return Type: boolean

script.zs
// DamageSource.scalesWithDifficulty() as boolean
myDamageSource.scalesWithDifficulty();

Return Type: DamageSource

script.zs
// DamageSource.setExplosion() as DamageSource
myDamageSource.setExplosion();

Return Type: DamageSource

script.zs
// DamageSource.setIsFall() as DamageSource
myDamageSource.setIsFall();

Return Type: DamageSource

script.zs
// DamageSource.setMagic() as DamageSource
myDamageSource.setMagic();

Return Type: DamageSource

script.zs
// DamageSource.setNoAggro() as DamageSource
myDamageSource.setNoAggro();

Return Type: DamageSource

script.zs
// DamageSource.setProjectile() as DamageSource
myDamageSource.setProjectile();

Return Type: DamageSource

script.zs
// DamageSource.setScalesWithDifficulty() as DamageSource
myDamageSource.setScalesWithDifficulty();

Properties

NameTypeHas GetterHas Setter
Name
directEntity
Type
Entity?
Has Getter
true
Has Setter
false
Name
doesBypassArmor
Type
boolean
Has Getter
true
Has Setter
false
Name
doesBypassInvul
Type
boolean
Has Getter
true
Has Setter
false
Name
doesBypassMagic
Type
boolean
Has Getter
true
Has Setter
false
Name
doesDamageHelmet
Type
boolean
Has Getter
true
Has Setter
false
Name
entity
Type
Entity?
Has Getter
true
Has Setter
false
Name
foodExhaustion
Type
float
Has Getter
true
Has Setter
false
Name
isCreativePlayer
Type
boolean
Has Getter
true
Has Setter
false
Name
isExplosion
Type
boolean
Has Getter
true
Has Setter
false
Name
isFall
Type
boolean
Has Getter
true
Has Setter
false
Name
isFire
Type
boolean
Has Getter
true
Has Setter
false
Name
isMagic
Type
boolean
Has Getter
true
Has Setter
false
Name
isNoAggro
Type
boolean
Has Getter
true
Has Setter
false
Name
isProjectile
Type
boolean
Has Getter
true
Has Setter
false
Name
msgId
Type
string
Has Getter
true
Has Setter
false
Name
scalesWithDifficulty
Type
boolean
Has Getter
true
Has Setter
false
Name
source
Type
Vec3?
Has Getter
true
Has Setter
false