ghast_protocol/generated/defs/p47/status/
clientbound.rs1#![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))]
34#[derive(Debug, Clone, PartialEq)]
36pub struct ServerInfo<const V: i32> {
37 pub response: ByteString,
39}
40#[cfg(any(
41 feature = "v1_8",
42 feature = "v1_12_2",
43 feature = "v1_16_5",
44 feature = "v26_1"
45))]
46impl<const V: i32> Decode for ServerInfo<V> {
47 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
48 Ok({
49 let v1 = r.read_string()?;
50 Self { response: v1 }
51 })
52 }
53}
54#[cfg(any(
55 feature = "v1_8",
56 feature = "v1_12_2",
57 feature = "v1_16_5",
58 feature = "v26_1"
59))]
60impl<const V: i32> Encode for ServerInfo<V> {
61 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
62 w.put_string(&(*self).response)?;
63 Ok(())
64 }
65}
66#[cfg(any(
67 feature = "v1_8",
68 feature = "v1_12_2",
69 feature = "v1_16_5",
70 feature = "v26_1"
71))]
72#[cfg(feature = "testgen")]
73impl<const V: i32> Generate for ServerInfo<V> {
74 fn generate(g: &mut Gen) -> Self {
75 {
76 let v1 = g.string();
77 Self { response: v1 }
78 }
79 }
80}
81
82#[cfg(any(
83 feature = "v1_8",
84 feature = "v1_12_2",
85 feature = "v1_16_5",
86 feature = "v26_1"
87))]
88#[derive(Debug, Clone, PartialEq)]
90pub struct Ping<const V: i32> {
91 pub time: i64,
93}
94#[cfg(any(
95 feature = "v1_8",
96 feature = "v1_12_2",
97 feature = "v1_16_5",
98 feature = "v26_1"
99))]
100impl<const V: i32> Decode for Ping<V> {
101 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
102 Ok({
103 let v1 = r.read_i64()?;
104 Self { time: v1 }
105 })
106 }
107}
108#[cfg(any(
109 feature = "v1_8",
110 feature = "v1_12_2",
111 feature = "v1_16_5",
112 feature = "v26_1"
113))]
114impl<const V: i32> Encode for Ping<V> {
115 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
116 w.put_i64((*self).time);
117 Ok(())
118 }
119}
120#[cfg(any(
121 feature = "v1_8",
122 feature = "v1_12_2",
123 feature = "v1_16_5",
124 feature = "v26_1"
125))]
126#[cfg(feature = "testgen")]
127impl<const V: i32> Generate for Ping<V> {
128 fn generate(g: &mut Gen) -> Self {
129 {
130 let v1 = g.i64();
131 Self { time: v1 }
132 }
133 }
134}