Skip to main content

ghast_protocol/generated/defs/p47/status/
clientbound.rs

1// @generated by ghast-codegen-protocol from PrismarineJS minecraft-data 3.119.0
2// (data/pc/1.8/protocol.json). Do not edit; run `cargo run -p ghast-codegen-protocol`.
3// minecraft-data is MIT licensed, Copyright (c) 2015 PrismarineJS; see the NOTICE file
4// in crates/ghast-protocol/src/generated/.
5
6//! Clientbound packets of the status state.
7
8#![allow(
9    unused_imports,
10    unused_variables,
11    unused_mut,
12    unused_parens,
13    unused_braces,
14    clippy::all,
15    clippy::pedantic,
16    non_camel_case_types,
17    non_snake_case
18)]
19use crate::codec::{Decode, DecodeResult, Encode, EncodeResult, McWrite, Reader, decode_exact};
20use crate::error::{DecodeError, EncodeError};
21use crate::nbt::{AnonNbt, RawNbt};
22use crate::packet::{Direction, PacketSet, RawPacket, State};
23#[cfg(feature = "testgen")]
24use crate::testgen::{Gen, Generate};
25use crate::types::{BlockPos, ByteString, Holder, HolderSet, LpVec3, PositionLayout, Uuid};
26use bytes::{BufMut, Bytes, BytesMut};
27
28#[cfg(any(
29    feature = "v1_8",
30    feature = "v1_12_2",
31    feature = "v1_16_5",
32    feature = "v26_1",
33    feature = "v26_2",
34    feature = "v26_3"
35))]
36/// `server_info` (clientbound status).
37#[derive(Debug, Clone, PartialEq)]
38pub struct ServerInfo<const V: i32> {
39    /// `response`
40    pub response: ByteString,
41}
42#[cfg(any(
43    feature = "v1_8",
44    feature = "v1_12_2",
45    feature = "v1_16_5",
46    feature = "v26_1",
47    feature = "v26_2",
48    feature = "v26_3"
49))]
50impl<const V: i32> Decode for ServerInfo<V> {
51    fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
52        Ok({
53            let v1 = r.read_string()?;
54            Self { response: v1 }
55        })
56    }
57}
58#[cfg(any(
59    feature = "v1_8",
60    feature = "v1_12_2",
61    feature = "v1_16_5",
62    feature = "v26_1",
63    feature = "v26_2",
64    feature = "v26_3"
65))]
66impl<const V: i32> Encode for ServerInfo<V> {
67    fn encode(&self, w: &mut BytesMut) -> EncodeResult {
68        w.put_string(&(*self).response)?;
69        Ok(())
70    }
71}
72#[cfg(any(
73    feature = "v1_8",
74    feature = "v1_12_2",
75    feature = "v1_16_5",
76    feature = "v26_1",
77    feature = "v26_2",
78    feature = "v26_3"
79))]
80#[cfg(feature = "testgen")]
81impl<const V: i32> Generate for ServerInfo<V> {
82    fn generate(g: &mut Gen) -> Self {
83        {
84            let v1 = g.string();
85            Self { response: v1 }
86        }
87    }
88}
89
90#[cfg(any(
91    feature = "v1_8",
92    feature = "v1_12_2",
93    feature = "v1_16_5",
94    feature = "v26_1",
95    feature = "v26_2",
96    feature = "v26_3"
97))]
98/// `ping` (clientbound status).
99#[derive(Debug, Clone, PartialEq)]
100pub struct Ping<const V: i32> {
101    /// `time`
102    pub time: i64,
103}
104#[cfg(any(
105    feature = "v1_8",
106    feature = "v1_12_2",
107    feature = "v1_16_5",
108    feature = "v26_1",
109    feature = "v26_2",
110    feature = "v26_3"
111))]
112impl<const V: i32> Decode for Ping<V> {
113    fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
114        Ok({
115            let v1 = r.read_i64()?;
116            Self { time: v1 }
117        })
118    }
119}
120#[cfg(any(
121    feature = "v1_8",
122    feature = "v1_12_2",
123    feature = "v1_16_5",
124    feature = "v26_1",
125    feature = "v26_2",
126    feature = "v26_3"
127))]
128impl<const V: i32> Encode for Ping<V> {
129    fn encode(&self, w: &mut BytesMut) -> EncodeResult {
130        w.put_i64((*self).time);
131        Ok(())
132    }
133}
134#[cfg(any(
135    feature = "v1_8",
136    feature = "v1_12_2",
137    feature = "v1_16_5",
138    feature = "v26_1",
139    feature = "v26_2",
140    feature = "v26_3"
141))]
142#[cfg(feature = "testgen")]
143impl<const V: i32> Generate for Ping<V> {
144    fn generate(g: &mut Gen) -> Self {
145        {
146            let v1 = g.i64();
147            Self { time: v1 }
148        }
149    }
150}