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