chunkedge_protocol/packets/play/
damage_event_s2c.rs

1use chunkedge_binary::{Decode, Encode, VarInt};
2use chunkedge_math::DVec3;
3
4use crate::Packet;
5
6#[derive(Copy, Clone, Debug, Encode, Decode, Packet)]
7pub struct DamageEventS2c {
8    /// The ID of the entity taking damage
9    pub entity_id: VarInt,
10    /// The ID of the type of damage taken
11    pub source_type_id: VarInt,
12    /// The ID + 1 of the entity responsible for the damage, if present. If not
13    /// present, the value is 0
14    pub source_cause_id: VarInt,
15    /// The ID + 1 of the entity that directly dealt the damage, if present. If
16    /// not present, the value is 0. If this field is present:
17    /// * and damage was dealt indirectly, such as by the use of a projectile,
18    ///   this field will contain the ID of such projectile;
19    /// * and damage was dealt directly, such as by manually attacking, this
20    ///   field will contain the same value as Source Cause ID.
21    pub source_direct_id: VarInt,
22    /// The Notchian server sends the Source Position when the damage was dealt
23    /// by the /damage command and a position was specified
24    pub source_pos: Option<DVec3>,
25}