Table of Contents

Class DamageSource

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll
public class DamageSource
Inheritance
DamageSource
Inherited Members
Extension Methods

Fields

CauseEntity

The entity that caused this damage, e.g. the entity that threw the SourceEntity projectile, if any

public Entity CauseEntity

Field Value

Entity

DamageTier

Tier of the weapon used to damage the entity, if any

public int DamageTier

Field Value

int

HitPosition

The relative hit position of where the damage occured.

public Vec3d HitPosition

Field Value

Vec3d

KnockbackStrength

The amount of knockback this damage will incur

public float KnockbackStrength

Field Value

float

Source

The type of source the damage came from.

public EnumDamageSource Source

Field Value

EnumDamageSource

SourceBlock

The source block the damage came from, if any

public Block SourceBlock

Field Value

Block

SourceEntity

The source entity the damage came from, if any

public Entity SourceEntity

Field Value

Entity

SourcePos

the location of the damage source.

public Vec3d SourcePos

Field Value

Vec3d

Type

The type of damage that was taken.

public EnumDamageType Type

Field Value

EnumDamageType

YDirKnockbackDiv

public float YDirKnockbackDiv

Field Value

float

Methods

GetAttackAngle(Vec3d, out double, out double)

If we have a hitposition this returns the pitch between the attacker and the attacked position

public bool GetAttackAngle(Vec3d attackedPos, out double attackYaw, out double attackPitch)

Parameters

attackedPos Vec3d
attackYaw double
attackPitch double

Returns

bool

GetCauseEntity()

Get the entity that caused the damage. If a projectile like a stone was thrown this will return the entity that threw the stone instead of the stone.

public Entity GetCauseEntity()

Returns

Entity

The entity that caused the damage

GetSourcePosition()

Fetches the location of the damage source from either SourcePos or SourceEntity

public Vec3d GetSourcePosition()

Returns

Vec3d