chunkedge_protocol/packets/play/
update_attributes_s2c.rs

1use std::borrow::Cow;
2
3use chunkedge_binary::{Decode, Encode, VarInt};
4use chunkedge_ident::Ident;
5
6use crate::Packet;
7#[derive(Clone, Debug, Encode, Decode, Packet)]
8pub struct UpdateAttributesS2c<'a> {
9    pub entity_id: VarInt,
10    pub properties: Vec<AttributeProperty<'a>>,
11}
12
13#[derive(Clone, PartialEq, Debug, Encode, Decode)]
14pub struct AttributeProperty<'a> {
15    pub id: VarInt, /* This could be an enum, but seems like arbitrary values are supported,
16                     * while a few are special */
17    pub value: f64,
18    pub modifiers: Vec<AttributeModifier<'a>>,
19}
20
21#[derive(Clone, PartialEq, Debug, Encode, Decode)]
22pub struct AttributeModifier<'a> {
23    pub id: Ident<Cow<'a, str>>,
24    pub amount: f64,
25    pub operation: u8,
26}