yog_event/entity/combat.rs
1//! Entities hurt and hit.
2
3use yog_data::Schema;
4
5/// Fired after a living entity takes damage (server side).
6#[derive(Debug, Clone, Schema)]
7pub struct Damage {
8 /// Registry id of the entity, e.g. `minecraft:zombie`.
9 pub entity_type: String,
10 pub uuid: String,
11 /// Amount of damage dealt (hit points).
12 pub amount: f32,
13 /// Identifier of the damage source, e.g. `minecraft:player`, `fall`.
14 pub source: String,
15 pub dimension: String,
16}
17
18/// Fired when a persistent projectile (arrow, trident, etc.) hits a target.
19///
20/// - `Pre` — return `false` to cancel the hit (projectile passes through).
21/// - `Post` — hit was processed.
22#[derive(Debug, Clone, Schema)]
23pub struct ProjectileHit {
24 /// Registry id of the projectile, e.g. `"minecraft:arrow"`.
25 pub projectile_type: String,
26 pub projectile_uuid: String,
27 /// UUID of the entity that fired the projectile, or empty string.
28 pub shooter_uuid: String,
29 /// `"block"` or `"entity"`.
30 pub hit_type: String,
31 /// UUID of the entity that was hit (empty for block hits).
32 pub hit_entity_uuid: String,
33 pub x: f64,
34 pub y: f64,
35 pub z: f64,
36 pub dimension: String,
37}