DamageSource

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

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

Members

static create(type as DamageType, directEntity as Entity = null, causingEntity as Entity = null) as DamageSource
script.zs
// DamageSource.create(type as DamageType, directEntity as Entity = null, causingEntity as Entity = null) as DamageSource;
DamageSource.create(myDamageType, myEntity, myEntity);

Parameters:

type Type: DamageType
directEntity (optional) Type: Entity

Default Value: null

causingEntity (optional) Type: Entity

Default Value: null

Return Type: DamageSource

static create(type as DamageType, damageSourcePosition as Vec3) as DamageSource
script.zs
// DamageSource.create(type as DamageType, damageSourcePosition as Vec3) as DamageSource;
DamageSource.create(myDamageType, myVec3);

Parameters:

type Type: DamageType
damageSourcePosition Type: Vec3

Return Type: DamageSource

Getter
script.zs
// DamageSource.directEntity as Entity
myDamageSource.directEntity

Return Type: Entity

Getter
script.zs
// DamageSource.entity as Entity
myDamageSource.entity

Return Type: Entity

Getter
script.zs
// DamageSource.foodExhaustion as float
myDamageSource.foodExhaustion

Return Type: float

getLocalizedDeathMessage(entity as LivingEntity) as Component
script.zs
// DamageSource.getLocalizedDeathMessage(entity as LivingEntity) as Component;
myDamageSource.getLocalizedDeathMessage(myLivingEntity);

Parameters:

entity Type: LivingEntity

Return Type: Component

Getter
script.zs
// DamageSource.indirect as bool
myDamageSource.indirect

Return Type: bool

Getter
script.zs
// DamageSource.isCreativePlayer as bool
myDamageSource.isCreativePlayer

Return Type: bool

isIn(tag as KnownTag<DamageType>) as bool
script.zs
// DamageSource.isIn(tag as KnownTag<DamageType>) as bool;
myDamageSource.isIn(myKnownTag);

Parameters:

Return Type: bool

Getter
script.zs
// DamageSource.msgId as string
myDamageSource.msgId

Return Type: string

Getter
script.zs
// DamageSource.scalesWithDifficulty as bool
myDamageSource.scalesWithDifficulty

Return Type: bool

Getter
script.zs
// DamageSource.sourcePosition as Vec3
myDamageSource.sourcePosition

Return Type: Vec3

Getter
script.zs
// DamageSource.sourcePositionRaw as Vec3
myDamageSource.sourcePositionRaw

Return Type: Vec3

Getter
script.zs
// DamageSource.type as DamageType
myDamageSource.type

Return Type: DamageType