Skip to content

API reference Obsidian.API.Entities

DamageSource record

What damaged an entity, like vanilla's DamageSource.

public sealed record DamageSource : IEquatable<DamageSource>

In Obsidian.API.

Constructors

DamageSource(string, IEntity, IEntity)

public DamageSource(string Type, IEntity Attacker, IEntity DirectEntity);

What damaged an entity, like vanilla's DamageSource.

Parameters

Type
The damage type's identifier, like minecraft:player_attack, minecraft:mob_attack, minecraft:arrow, minecraft:fall, minecraft:on_fire or minecraft:magic.
Attacker
The entity responsible, like the player who shot an arrow, if any.
DirectEntity
The entity that dealt it, like the arrow, if any.

Properties

Attacker

public IEntity Attacker { get; init; }

The entity responsible, like the player who shot an arrow, if any.

DirectEntity

public IEntity DirectEntity { get; init; }

The entity that dealt it, like the arrow, if any.

Type

public string Type { get; init; }

The damage type's identifier, like minecraft:player_attack, minecraft:mob_attack, minecraft:arrow, minecraft:fall, minecraft:on_fire or minecraft:magic.

On this page