Skip to main content

steel_protocol/packets/
shared_implementation.rs

1use steel_macros::{ReadFrom, WriteTo};
2
3#[derive(Clone, Debug, WriteTo, ReadFrom)]
4pub struct KnownPack {
5    #[write(as = Prefixed(VarInt))]
6    #[read(as = Prefixed(VarInt))]
7    pub namespace: String,
8    #[write(as = Prefixed(VarInt))]
9    #[read(as = Prefixed(VarInt))]
10    pub id: String,
11    #[write(as = Prefixed(VarInt))]
12    #[read(as = Prefixed(VarInt))]
13    pub version: String,
14}
15
16impl KnownPack {
17    #[must_use]
18    pub const fn new(namespace: String, id: String, version: String) -> Self {
19        Self {
20            namespace,
21            id,
22            version,
23        }
24    }
25}