Skip to main content

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