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