Skip to main content

yog_event/entity/
life.rs

1//! Entities appearing and dying.
2
3use yog_data::Schema;
4
5/// Fired when any entity is loaded into a world (server side).
6///
7/// Also used for `on_entity_spawn_pre` (cancellable): return `false` to
8/// discard the entity immediately after loading (effective spawn cancellation).
9#[derive(Debug, Clone, Schema)]
10pub struct Spawn {
11    /// Registry id of the entity, e.g. `minecraft:zombie`.
12    pub entity_type: String,
13    pub uuid: String,
14    /// Dimension the entity was added to, e.g. `minecraft:overworld`.
15    pub dimension: String,
16}
17
18/// Fired after a living entity dies (server side).
19#[derive(Debug, Clone, Schema)]
20pub struct Death {
21    /// Registry id of the entity, e.g. `minecraft:zombie`.
22    pub entity_type: String,
23    pub uuid: String,
24    /// Identifier of the killing damage source, e.g. `minecraft:player`.
25    pub source: String,
26    pub dimension: String,
27}