#![allow(
unused_imports,
unused_variables,
unused_mut,
unused_parens,
unused_braces,
clippy::all,
clippy::pedantic,
non_camel_case_types,
non_snake_case
)]
use crate::codec::{Decode, DecodeResult, Encode, EncodeResult, McWrite, Reader, decode_exact};
use crate::error::{DecodeError, EncodeError};
use crate::nbt::{AnonNbt, RawNbt};
use crate::packet::{Direction, PacketSet, RawPacket, State};
#[cfg(feature = "testgen")]
use crate::testgen::{Gen, Generate};
use crate::types::{BlockPos, ByteString, Holder, HolderSet, LpVec3, PositionLayout, Uuid};
use bytes::{BufMut, Bytes, BytesMut};
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct Attack<const V: i32> {
pub entity_id: i32,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for Attack<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_varint()?;
Self { entity_id: v1 }
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for Attack<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).entity_id);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for Attack<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
Self { entity_id: v1 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct SelectBundleItem<const V: i32> {
pub slot_id: i32,
pub selected_item_index: i32,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for SelectBundleItem<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_varint()?;
let v2 = r.read_varint()?;
Self {
slot_id: v1,
selected_item_index: v2,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for SelectBundleItem<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).slot_id);
w.put_varint((*self).selected_item_index);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for SelectBundleItem<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
Self {
slot_id: v1,
selected_item_index: v2,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
pub struct SetDifficultyNewDifficulty(pub i32);
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl SetDifficultyNewDifficulty {
pub const PEACEFUL: Self = Self(0);
pub const EASY: Self = Self(1);
pub const NORMAL: Self = Self(2);
pub const HARD: Self = Self(3);
pub const fn name(self) -> Option<&'static str> {
match self.0 {
0 => Some("peaceful"),
1 => Some("easy"),
2 => Some("normal"),
3 => Some("hard"),
_ => None,
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl std::fmt::Debug for SetDifficultyNewDifficulty {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.name() {
Some(n) => write!(f, "SetDifficultyNewDifficulty::{n}"),
None => write!(f, "SetDifficultyNewDifficulty({})", self.0),
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct SetDifficulty<const V: i32> {
pub new_difficulty: crate::defs::p775::play::serverbound::SetDifficultyNewDifficulty,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for SetDifficulty<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 =
crate::defs::p775::play::serverbound::SetDifficultyNewDifficulty(r.read_varint()?);
Self { new_difficulty: v1 }
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for SetDifficulty<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).new_difficulty.0);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for SetDifficulty<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = crate::defs::p775::play::serverbound::SetDifficultyNewDifficulty(g.int_in(
-2147483648,
2147483647,
&[0, 1, 2, 3],
)
as i32);
Self { new_difficulty: v1 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
pub struct ChangeGamemodeMode(pub i32);
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl ChangeGamemodeMode {
pub const SURVIVAL: Self = Self(0);
pub const CREATIVE: Self = Self(1);
pub const ADVENTURE: Self = Self(2);
pub const SPECTATOR: Self = Self(3);
pub const fn name(self) -> Option<&'static str> {
match self.0 {
0 => Some("survival"),
1 => Some("creative"),
2 => Some("adventure"),
3 => Some("spectator"),
_ => None,
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl std::fmt::Debug for ChangeGamemodeMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.name() {
Some(n) => write!(f, "ChangeGamemodeMode::{n}"),
None => write!(f, "ChangeGamemodeMode({})", self.0),
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct ChangeGamemode<const V: i32> {
pub mode: crate::defs::p775::play::serverbound::ChangeGamemodeMode,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for ChangeGamemode<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = crate::defs::p775::play::serverbound::ChangeGamemodeMode(r.read_varint()?);
Self { mode: v1 }
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for ChangeGamemode<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).mode.0);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for ChangeGamemode<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = crate::defs::p775::play::serverbound::ChangeGamemodeMode(g.int_in(
-2147483648,
2147483647,
&[0, 1, 2, 3],
) as i32);
Self { mode: v1 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct MessageAcknowledgement<const V: i32> {
pub count: i32,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for MessageAcknowledgement<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_varint()?;
Self { count: v1 }
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for MessageAcknowledgement<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).count);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for MessageAcknowledgement<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
Self { count: v1 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct ChatCommand<const V: i32> {
pub command: ByteString,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for ChatCommand<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_string()?;
Self { command: v1 }
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for ChatCommand<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_string(&(*self).command)?;
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for ChatCommand<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.string();
Self { command: v1 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct ChatCommandSignedArgumentSignatures {
pub argument_name: ByteString,
pub signature: Bytes,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct ChatCommandSigned<const V: i32> {
pub command: ByteString,
pub timestamp: i64,
pub salt: i64,
pub argument_signatures:
Vec<crate::defs::p775::play::serverbound::ChatCommandSignedArgumentSignatures>,
pub message_count: i32,
pub acknowledged: Bytes,
pub checksum: u8,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for ChatCommandSigned<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_string()?;
let v2 = r.read_i64()?;
let v3 = r.read_i64()?;
let v4 = {
let v5 = {
let c = r.read_varint()?;
r.check_count(i64::from(c), 257)?
};
let mut v6 = Vec::with_capacity(v5.min(crate::codec::PREALLOC_LIMIT));
for _ in 0..v5 {
v6.push({
let v7 = r.read_string()?;
let v8 = r.read_bytes(256)?;
crate::defs::p775::play::serverbound::ChatCommandSignedArgumentSignatures {
argument_name: v7,
signature: v8,
}
});
}
v6
};
let v9 = r.read_varint()?;
let v10 = r.read_bytes(3)?;
let v11 = r.read_u8()?;
Self {
command: v1,
timestamp: v2,
salt: v3,
argument_signatures: v4,
message_count: v9,
acknowledged: v10,
checksum: v11,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for ChatCommandSigned<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_string(&(*self).command)?;
w.put_i64((*self).timestamp);
w.put_i64((*self).salt);
w.put_len_varint((*self).argument_signatures.len())?;
for v1 in (*self).argument_signatures.iter() {
w.put_string(&(*v1).argument_name)?;
if (*v1).signature.len() != 256 {
return Err(EncodeError::CountMismatch {
field: "fixed buffer",
expected: 256,
actual: (*v1).signature.len(),
});
}
w.put_slice(&(*v1).signature);
}
w.put_varint((*self).message_count);
if (*self).acknowledged.len() != 3 {
return Err(EncodeError::CountMismatch {
field: "fixed buffer",
expected: 3,
actual: (*self).acknowledged.len(),
});
}
w.put_slice(&(*self).acknowledged);
w.put_u8((*self).checksum);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for ChatCommandSigned<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.string();
let v2 = g.i64();
let v3 = g.i64();
let v4 = {
let v5 = g.count();
let mut v6 = Vec::with_capacity(v5.min(crate::codec::PREALLOC_LIMIT));
for _ in 0..v5 {
v6.push({
let v7 = g.string();
let v8 = g.fixed_bytes(256);
crate::defs::p775::play::serverbound::ChatCommandSignedArgumentSignatures {
argument_name: v7,
signature: v8,
}
});
}
v6
};
let v9 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v10 = g.fixed_bytes(3);
let v11 = (g.int_in(0, 255, &[]) as u8);
Self {
command: v1,
timestamp: v2,
salt: v3,
argument_signatures: v4,
message_count: v9,
acknowledged: v10,
checksum: v11,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct ChatMessage<const V: i32> {
pub message: ByteString,
pub timestamp: i64,
pub salt: i64,
pub signature: Option<Bytes>,
pub offset: i32,
pub acknowledged: Bytes,
pub checksum: u8,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for ChatMessage<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_string()?;
let v2 = r.read_i64()?;
let v3 = r.read_i64()?;
let v4 = if r.read_bool()? {
Some(r.read_bytes(256)?)
} else {
None
};
let v5 = r.read_varint()?;
let v6 = r.read_bytes(3)?;
let v7 = r.read_u8()?;
Self {
message: v1,
timestamp: v2,
salt: v3,
signature: v4,
offset: v5,
acknowledged: v6,
checksum: v7,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for ChatMessage<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_string(&(*self).message)?;
w.put_i64((*self).timestamp);
w.put_i64((*self).salt);
match &(*self).signature {
Some(v1) => {
w.put_u8(1);
if (*v1).len() != 256 {
return Err(EncodeError::CountMismatch {
field: "fixed buffer",
expected: 256,
actual: (*v1).len(),
});
}
w.put_slice(&(*v1));
}
None => w.put_u8(0),
}
w.put_varint((*self).offset);
if (*self).acknowledged.len() != 3 {
return Err(EncodeError::CountMismatch {
field: "fixed buffer",
expected: 3,
actual: (*self).acknowledged.len(),
});
}
w.put_slice(&(*self).acknowledged);
w.put_u8((*self).checksum);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for ChatMessage<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.string();
let v2 = g.i64();
let v3 = g.i64();
let v4 = if g.bool() {
Some(g.fixed_bytes(256))
} else {
None
};
let v5 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v6 = g.fixed_bytes(3);
let v7 = (g.int_in(0, 255, &[]) as u8);
Self {
message: v1,
timestamp: v2,
salt: v3,
signature: v4,
offset: v5,
acknowledged: v6,
checksum: v7,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct ChatSessionUpdate<const V: i32> {
pub session_uuid: Uuid,
pub expire_time: i64,
pub public_key: Bytes,
pub signature: Bytes,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for ChatSessionUpdate<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_uuid()?;
let v2 = r.read_i64()?;
let v3 = r.read_byte_array()?;
let v4 = r.read_byte_array()?;
Self {
session_uuid: v1,
expire_time: v2,
public_key: v3,
signature: v4,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for ChatSessionUpdate<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_uuid(&(*self).session_uuid);
w.put_i64((*self).expire_time);
w.put_byte_array(&(*self).public_key)?;
w.put_byte_array(&(*self).signature)?;
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for ChatSessionUpdate<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.uuid();
let v2 = g.i64();
let v3 = g.bytes();
let v4 = g.bytes();
Self {
session_uuid: v1,
expire_time: v2,
public_key: v3,
signature: v4,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct ChunkBatchReceived<const V: i32> {
pub chunks_per_tick: f32,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for ChunkBatchReceived<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_f32()?;
Self {
chunks_per_tick: v1,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for ChunkBatchReceived<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_f32((*self).chunks_per_tick);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for ChunkBatchReceived<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.f32();
Self {
chunks_per_tick: v1,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
pub struct ClientCommandActionId(pub i32);
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl ClientCommandActionId {
pub const PERFORM_RESPAWN: Self = Self(0);
pub const REQUEST_STATS: Self = Self(1);
pub const REQUEST_GAMERULE_VALUES: Self = Self(2);
pub const fn name(self) -> Option<&'static str> {
match self.0 {
0 => Some("perform_respawn"),
1 => Some("request_stats"),
2 => Some("request_gamerule_values"),
_ => None,
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl std::fmt::Debug for ClientCommandActionId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.name() {
Some(n) => write!(f, "ClientCommandActionId::{n}"),
None => write!(f, "ClientCommandActionId({})", self.0),
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct ClientCommand<const V: i32> {
pub action_id: crate::defs::p775::play::serverbound::ClientCommandActionId,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for ClientCommand<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = crate::defs::p775::play::serverbound::ClientCommandActionId(r.read_varint()?);
Self { action_id: v1 }
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for ClientCommand<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).action_id.0);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for ClientCommand<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = crate::defs::p775::play::serverbound::ClientCommandActionId(g.int_in(
-2147483648,
2147483647,
&[0, 1, 2],
)
as i32);
Self { action_id: v1 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct TickEnd<const V: i32> {}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for TickEnd<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({ Self {} })
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for TickEnd<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for TickEnd<V> {
fn generate(g: &mut Gen) -> Self {
{ Self {} }
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
pub struct SettingsParticleStatus(pub i32);
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl SettingsParticleStatus {
pub const ALL: Self = Self(0);
pub const DECREASED: Self = Self(1);
pub const MINIMAL: Self = Self(2);
pub const fn name(self) -> Option<&'static str> {
match self.0 {
0 => Some("all"),
1 => Some("decreased"),
2 => Some("minimal"),
_ => None,
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl std::fmt::Debug for SettingsParticleStatus {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.name() {
Some(n) => write!(f, "SettingsParticleStatus::{n}"),
None => write!(f, "SettingsParticleStatus({})", self.0),
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct Settings<const V: i32> {
pub locale: ByteString,
pub view_distance: i8,
pub chat_flags: i32,
pub chat_colors: bool,
pub skin_parts: u8,
pub main_hand: i32,
pub enable_text_filtering: bool,
pub enable_server_listing: bool,
pub particle_status: crate::defs::p775::play::serverbound::SettingsParticleStatus,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for Settings<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_string()?;
let v2 = r.read_i8()?;
let v3 = r.read_varint()?;
let v4 = r.read_bool()?;
let v5 = r.read_u8()?;
let v6 = r.read_varint()?;
let v7 = r.read_bool()?;
let v8 = r.read_bool()?;
let v9 = crate::defs::p775::play::serverbound::SettingsParticleStatus(r.read_varint()?);
Self {
locale: v1,
view_distance: v2,
chat_flags: v3,
chat_colors: v4,
skin_parts: v5,
main_hand: v6,
enable_text_filtering: v7,
enable_server_listing: v8,
particle_status: v9,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for Settings<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_string(&(*self).locale)?;
w.put_i8((*self).view_distance);
w.put_varint((*self).chat_flags);
w.put_bool((*self).chat_colors);
w.put_u8((*self).skin_parts);
w.put_varint((*self).main_hand);
w.put_bool((*self).enable_text_filtering);
w.put_bool((*self).enable_server_listing);
w.put_varint((*self).particle_status.0);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for Settings<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.string();
let v2 = (g.int_in(-128, 127, &[]) as i8);
let v3 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v4 = g.bool();
let v5 = (g.int_in(0, 255, &[]) as u8);
let v6 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v7 = g.bool();
let v8 = g.bool();
let v9 = crate::defs::p775::play::serverbound::SettingsParticleStatus(g.int_in(
-2147483648,
2147483647,
&[0, 1, 2],
)
as i32);
Self {
locale: v1,
view_distance: v2,
chat_flags: v3,
chat_colors: v4,
skin_parts: v5,
main_hand: v6,
enable_text_filtering: v7,
enable_server_listing: v8,
particle_status: v9,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct ConfigurationAcknowledged<const V: i32> {}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for ConfigurationAcknowledged<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({ Self {} })
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for ConfigurationAcknowledged<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for ConfigurationAcknowledged<V> {
fn generate(g: &mut Gen) -> Self {
{ Self {} }
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct EnchantItem<const V: i32> {
pub window_id: i32,
pub enchantment: i32,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for EnchantItem<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_varint()?;
let v2 = r.read_varint()?;
Self {
window_id: v1,
enchantment: v2,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for EnchantItem<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).window_id);
w.put_varint((*self).enchantment);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for EnchantItem<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
Self {
window_id: v1,
enchantment: v2,
}
}
}
}
#[cfg(feature = "v26_1")]
#[derive(Debug, Clone, PartialEq)]
pub struct WindowClickChangedSlots {
pub location: i16,
pub item: Option<crate::defs::p775::types::HashedSlot>,
}
#[cfg(feature = "v26_1")]
#[derive(Debug, Clone, PartialEq)]
pub struct WindowClick<const V: i32> {
pub window_id: i32,
pub state_id: i32,
pub slot: i16,
pub mouse_button: i8,
pub mode: i32,
pub changed_slots: Vec<crate::defs::p775::play::serverbound::WindowClickChangedSlots>,
pub cursor_item: Option<crate::defs::p775::types::HashedSlot>,
}
#[cfg(feature = "v26_1")]
impl<const V: i32> Decode for WindowClick<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_varint()?;
let v2 = r.read_varint()?;
let v3 = r.read_i16()?;
let v4 = r.read_i8()?;
let v5 = r.read_varint()?;
let v6 = {
let v7 = {
let c = r.read_varint()?;
r.check_count(i64::from(c), 3)?
};
let mut v8 = Vec::with_capacity(v7.min(crate::codec::PREALLOC_LIMIT));
for _ in 0..v7 {
v8.push({
let v9 = r.read_i16()?;
let v10 = if r.read_bool()? {
Some(<crate::defs::p775::types::HashedSlot as Decode>::decode(r)?)
} else {
None
};
crate::defs::p775::play::serverbound::WindowClickChangedSlots {
location: v9,
item: v10,
}
});
}
v8
};
let v11 = if r.read_bool()? {
Some(<crate::defs::p775::types::HashedSlot as Decode>::decode(r)?)
} else {
None
};
Self {
window_id: v1,
state_id: v2,
slot: v3,
mouse_button: v4,
mode: v5,
changed_slots: v6,
cursor_item: v11,
}
})
}
}
#[cfg(feature = "v26_1")]
impl<const V: i32> Encode for WindowClick<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).window_id);
w.put_varint((*self).state_id);
w.put_i16((*self).slot);
w.put_i8((*self).mouse_button);
w.put_varint((*self).mode);
w.put_len_varint((*self).changed_slots.len())?;
for v1 in (*self).changed_slots.iter() {
w.put_i16((*v1).location);
match &(*v1).item {
Some(v2) => {
w.put_u8(1);
(*v2).encode(w)?;
}
None => w.put_u8(0),
}
}
match &(*self).cursor_item {
Some(v3) => {
w.put_u8(1);
(*v3).encode(w)?;
}
None => w.put_u8(0),
}
Ok(())
}
}
#[cfg(feature = "v26_1")]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for WindowClick<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v3 = (g.int_in(-32768, 32767, &[]) as i16);
let v4 = (g.int_in(-128, 127, &[]) as i8);
let v5 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v6 = {
let v7 = g.count();
let mut v8 = Vec::with_capacity(v7.min(crate::codec::PREALLOC_LIMIT));
for _ in 0..v7 {
v8.push({
let v9 = (g.int_in(-32768, 32767, &[]) as i16);
let v10 = if g.bool() {
Some(<crate::defs::p775::types::HashedSlot as Generate>::generate(g))
} else {
None
};
crate::defs::p775::play::serverbound::WindowClickChangedSlots {
location: v9,
item: v10,
}
});
}
v8
};
let v11 = if g.bool() {
Some(<crate::defs::p775::types::HashedSlot as Generate>::generate(g))
} else {
None
};
Self {
window_id: v1,
state_id: v2,
slot: v3,
mouse_button: v4,
mode: v5,
changed_slots: v6,
cursor_item: v11,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct CloseWindow<const V: i32> {
pub window_id: i32,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for CloseWindow<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_varint()?;
Self { window_id: v1 }
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for CloseWindow<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).window_id);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for CloseWindow<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
Self { window_id: v1 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct SetSlotState<const V: i32> {
pub slot_id: i32,
pub window_id: i32,
pub state: bool,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for SetSlotState<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_varint()?;
let v2 = r.read_varint()?;
let v3 = r.read_bool()?;
Self {
slot_id: v1,
window_id: v2,
state: v3,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for SetSlotState<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).slot_id);
w.put_varint((*self).window_id);
w.put_bool((*self).state);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for SetSlotState<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v3 = g.bool();
Self {
slot_id: v1,
window_id: v2,
state: v3,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct CookieResponse<const V: i32> {
pub key: ByteString,
pub value: Option<Bytes>,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for CookieResponse<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_string()?;
let v2 = if r.read_bool()? {
Some(r.read_byte_array()?)
} else {
None
};
Self { key: v1, value: v2 }
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for CookieResponse<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_string(&(*self).key)?;
match &(*self).value {
Some(v1) => {
w.put_u8(1);
w.put_byte_array(&(*v1))?;
}
None => w.put_u8(0),
}
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for CookieResponse<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.string();
let v2 = if g.bool() { Some(g.bytes()) } else { None };
Self { key: v1, value: v2 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct DebugSubscriptionRequest<const V: i32> {
pub subscriptions: Vec<crate::defs::p775::types::DebugSubscriptionDataType>,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for DebugSubscriptionRequest<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = {
let v2 = {
let c = r.read_varint()?;
r.check_count(i64::from(c), 1)?
};
let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
for _ in 0..v2 {
v3.push(crate::defs::p775::types::DebugSubscriptionDataType(
r.read_varint()?,
));
}
v3
};
Self { subscriptions: v1 }
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for DebugSubscriptionRequest<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_len_varint((*self).subscriptions.len())?;
for v1 in (*self).subscriptions.iter() {
w.put_varint((*v1).0);
}
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for DebugSubscriptionRequest<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = {
let v2 = g.count();
let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
for _ in 0..v2 {
v3.push(crate::defs::p775::types::DebugSubscriptionDataType(
g.int_in(
-2147483648,
2147483647,
&[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
) as i32,
));
}
v3
};
Self { subscriptions: v1 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct EditBook<const V: i32> {
pub hand: i32,
pub pages: Vec<ByteString>,
pub title: Option<ByteString>,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for EditBook<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_varint()?;
let v2 = {
let v3 = {
let c = r.read_varint()?;
r.check_count(i64::from(c), 1)?
};
let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
for _ in 0..v3 {
v4.push(r.read_string()?);
}
v4
};
let v5 = if r.read_bool()? {
Some(r.read_string()?)
} else {
None
};
Self {
hand: v1,
pages: v2,
title: v5,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for EditBook<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).hand);
w.put_len_varint((*self).pages.len())?;
for v1 in (*self).pages.iter() {
w.put_string(&(*v1))?;
}
match &(*self).title {
Some(v2) => {
w.put_u8(1);
w.put_string(&(*v2))?;
}
None => w.put_u8(0),
}
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for EditBook<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v2 = {
let v3 = g.count();
let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
for _ in 0..v3 {
v4.push(g.string());
}
v4
};
let v5 = if g.bool() { Some(g.string()) } else { None };
Self {
hand: v1,
pages: v2,
title: v5,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
pub struct UseEntityHand(pub i32);
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl UseEntityHand {
pub const MAIN_HAND: Self = Self(0);
pub const OFF_HAND: Self = Self(1);
pub const fn name(self) -> Option<&'static str> {
match self.0 {
0 => Some("main_hand"),
1 => Some("off_hand"),
_ => None,
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl std::fmt::Debug for UseEntityHand {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.name() {
Some(n) => write!(f, "UseEntityHand::{n}"),
None => write!(f, "UseEntityHand({})", self.0),
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct UseEntity<const V: i32> {
pub target: i32,
pub hand: crate::defs::p775::play::serverbound::UseEntityHand,
pub location: LpVec3,
pub sneaking: bool,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for UseEntity<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_varint()?;
let v2 = crate::defs::p775::play::serverbound::UseEntityHand(r.read_varint()?);
let v3 = LpVec3::read(r)?;
let v4 = r.read_bool()?;
Self {
target: v1,
hand: v2,
location: v3,
sneaking: v4,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for UseEntity<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).target);
w.put_varint((*self).hand.0);
(*self).location.write(w);
w.put_bool((*self).sneaking);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for UseEntity<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v2 = crate::defs::p775::play::serverbound::UseEntityHand(g.int_in(
-2147483648,
2147483647,
&[0, 1],
) as i32);
let v3 = <LpVec3 as Generate>::generate(g);
let v4 = g.bool();
Self {
target: v1,
hand: v2,
location: v3,
sneaking: v4,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
pub struct MovementFlags(pub u8);
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl MovementFlags {
pub const ON_GROUND: Self = Self(1 << 0);
pub const HAS_HORIZONTAL_COLLISION: Self = Self(1 << 1);
#[inline]
pub const fn contains(self, f: Self) -> bool {
self.0 & f.0 == f.0
}
#[inline]
#[must_use]
pub const fn with(self, f: Self) -> Self {
Self(self.0 | f.0)
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct Position<const V: i32> {
pub x: f64,
pub y: f64,
pub z: f64,
pub flags: crate::defs::p775::play::serverbound::MovementFlags,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for Position<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_f64()?;
let v2 = r.read_f64()?;
let v3 = r.read_f64()?;
let v4 = crate::defs::p775::play::serverbound::MovementFlags(r.read_u8()?);
Self {
x: v1,
y: v2,
z: v3,
flags: v4,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for Position<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_f64((*self).x);
w.put_f64((*self).y);
w.put_f64((*self).z);
w.put_u8((*self).flags.0);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for Position<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.f64();
let v2 = g.f64();
let v3 = g.f64();
let v4 =
crate::defs::p775::play::serverbound::MovementFlags(g.int_in(0, 255, &[]) as u8);
Self {
x: v1,
y: v2,
z: v3,
flags: v4,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct PositionLook<const V: i32> {
pub x: f64,
pub y: f64,
pub z: f64,
pub yaw: f32,
pub pitch: f32,
pub flags: crate::defs::p775::play::serverbound::MovementFlags,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for PositionLook<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_f64()?;
let v2 = r.read_f64()?;
let v3 = r.read_f64()?;
let v4 = r.read_f32()?;
let v5 = r.read_f32()?;
let v6 = crate::defs::p775::play::serverbound::MovementFlags(r.read_u8()?);
Self {
x: v1,
y: v2,
z: v3,
yaw: v4,
pitch: v5,
flags: v6,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for PositionLook<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_f64((*self).x);
w.put_f64((*self).y);
w.put_f64((*self).z);
w.put_f32((*self).yaw);
w.put_f32((*self).pitch);
w.put_u8((*self).flags.0);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for PositionLook<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.f64();
let v2 = g.f64();
let v3 = g.f64();
let v4 = g.f32();
let v5 = g.f32();
let v6 =
crate::defs::p775::play::serverbound::MovementFlags(g.int_in(0, 255, &[]) as u8);
Self {
x: v1,
y: v2,
z: v3,
yaw: v4,
pitch: v5,
flags: v6,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct Look<const V: i32> {
pub yaw: f32,
pub pitch: f32,
pub flags: crate::defs::p775::play::serverbound::MovementFlags,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for Look<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_f32()?;
let v2 = r.read_f32()?;
let v3 = crate::defs::p775::play::serverbound::MovementFlags(r.read_u8()?);
Self {
yaw: v1,
pitch: v2,
flags: v3,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for Look<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_f32((*self).yaw);
w.put_f32((*self).pitch);
w.put_u8((*self).flags.0);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for Look<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.f32();
let v2 = g.f32();
let v3 =
crate::defs::p775::play::serverbound::MovementFlags(g.int_in(0, 255, &[]) as u8);
Self {
yaw: v1,
pitch: v2,
flags: v3,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct Flying<const V: i32> {
pub flags: crate::defs::p775::play::serverbound::MovementFlags,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for Flying<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = crate::defs::p775::play::serverbound::MovementFlags(r.read_u8()?);
Self { flags: v1 }
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for Flying<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_u8((*self).flags.0);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for Flying<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 =
crate::defs::p775::play::serverbound::MovementFlags(g.int_in(0, 255, &[]) as u8);
Self { flags: v1 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct VehicleMove<const V: i32> {
pub x: f64,
pub y: f64,
pub z: f64,
pub yaw: f32,
pub pitch: f32,
pub on_ground: bool,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for VehicleMove<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_f64()?;
let v2 = r.read_f64()?;
let v3 = r.read_f64()?;
let v4 = r.read_f32()?;
let v5 = r.read_f32()?;
let v6 = r.read_bool()?;
Self {
x: v1,
y: v2,
z: v3,
yaw: v4,
pitch: v5,
on_ground: v6,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for VehicleMove<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_f64((*self).x);
w.put_f64((*self).y);
w.put_f64((*self).z);
w.put_f32((*self).yaw);
w.put_f32((*self).pitch);
w.put_bool((*self).on_ground);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for VehicleMove<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.f64();
let v2 = g.f64();
let v3 = g.f64();
let v4 = g.f32();
let v5 = g.f32();
let v6 = g.bool();
Self {
x: v1,
y: v2,
z: v3,
yaw: v4,
pitch: v5,
on_ground: v6,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct PickItemFromBlock<const V: i32> {
pub position: BlockPos,
pub include_data: bool,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for PickItemFromBlock<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = BlockPos::read(r, PositionLayout::Xzy)?;
let v2 = r.read_bool()?;
Self {
position: v1,
include_data: v2,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for PickItemFromBlock<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
(*self).position.write(w, PositionLayout::Xzy)?;
w.put_bool((*self).include_data);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for PickItemFromBlock<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.position();
let v2 = g.bool();
Self {
position: v1,
include_data: v2,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct PickItemFromEntity<const V: i32> {
pub entity_id: i32,
pub include_data: bool,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for PickItemFromEntity<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_varint()?;
let v2 = r.read_bool()?;
Self {
entity_id: v1,
include_data: v2,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for PickItemFromEntity<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).entity_id);
w.put_bool((*self).include_data);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for PickItemFromEntity<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v2 = g.bool();
Self {
entity_id: v1,
include_data: v2,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct PingRequest<const V: i32> {
pub id: i64,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for PingRequest<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_i64()?;
Self { id: v1 }
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for PingRequest<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_i64((*self).id);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for PingRequest<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.i64();
Self { id: v1 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct CraftRecipeRequest<const V: i32> {
pub window_id: i32,
pub recipe_id: i32,
pub make_all: bool,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for CraftRecipeRequest<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_varint()?;
let v2 = r.read_varint()?;
let v3 = r.read_bool()?;
Self {
window_id: v1,
recipe_id: v2,
make_all: v3,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for CraftRecipeRequest<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).window_id);
w.put_varint((*self).recipe_id);
w.put_bool((*self).make_all);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for CraftRecipeRequest<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v3 = g.bool();
Self {
window_id: v1,
recipe_id: v2,
make_all: v3,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct BlockDig<const V: i32> {
pub status: i32,
pub location: BlockPos,
pub face: i8,
pub sequence: i32,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for BlockDig<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_varint()?;
let v2 = BlockPos::read(r, PositionLayout::Xzy)?;
let v3 = r.read_i8()?;
let v4 = r.read_varint()?;
Self {
status: v1,
location: v2,
face: v3,
sequence: v4,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for BlockDig<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).status);
(*self).location.write(w, PositionLayout::Xzy)?;
w.put_i8((*self).face);
w.put_varint((*self).sequence);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for BlockDig<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v2 = g.position();
let v3 = (g.int_in(-128, 127, &[]) as i8);
let v4 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
Self {
status: v1,
location: v2,
face: v3,
sequence: v4,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
pub struct EntityActionActionId(pub i32);
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl EntityActionActionId {
pub const STOP_SLEEPING: Self = Self(0);
pub const START_SPRINTING: Self = Self(1);
pub const STOP_SPRINTING: Self = Self(2);
pub const START_RIDING_JUMP: Self = Self(3);
pub const STOP_RIDING_JUMP: Self = Self(4);
pub const OPEN_INVENTORY: Self = Self(5);
pub const START_FALL_FLYING: Self = Self(6);
pub const fn name(self) -> Option<&'static str> {
match self.0 {
0 => Some("stop_sleeping"),
1 => Some("start_sprinting"),
2 => Some("stop_sprinting"),
3 => Some("start_riding_jump"),
4 => Some("stop_riding_jump"),
5 => Some("open_inventory"),
6 => Some("start_fall_flying"),
_ => None,
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl std::fmt::Debug for EntityActionActionId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.name() {
Some(n) => write!(f, "EntityActionActionId::{n}"),
None => write!(f, "EntityActionActionId({})", self.0),
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct EntityAction<const V: i32> {
pub entity_id: i32,
pub action_id: crate::defs::p775::play::serverbound::EntityActionActionId,
pub jump_boost: i32,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for EntityAction<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_varint()?;
let v2 = crate::defs::p775::play::serverbound::EntityActionActionId(r.read_varint()?);
let v3 = r.read_varint()?;
Self {
entity_id: v1,
action_id: v2,
jump_boost: v3,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for EntityAction<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).entity_id);
w.put_varint((*self).action_id.0);
w.put_varint((*self).jump_boost);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for EntityAction<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v2 = crate::defs::p775::play::serverbound::EntityActionActionId(g.int_in(
-2147483648,
2147483647,
&[0, 1, 2, 3, 4, 5, 6],
)
as i32);
let v3 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
Self {
entity_id: v1,
action_id: v2,
jump_boost: v3,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
pub struct PlayerInputInputs(pub u8);
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl PlayerInputInputs {
pub const FORWARD: Self = Self(1 << 0);
pub const BACKWARD: Self = Self(1 << 1);
pub const LEFT: Self = Self(1 << 2);
pub const RIGHT: Self = Self(1 << 3);
pub const JUMP: Self = Self(1 << 4);
pub const SHIFT: Self = Self(1 << 5);
pub const SPRINT: Self = Self(1 << 6);
#[inline]
pub const fn contains(self, f: Self) -> bool {
self.0 & f.0 == f.0
}
#[inline]
#[must_use]
pub const fn with(self, f: Self) -> Self {
Self(self.0 | f.0)
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct PlayerInput<const V: i32> {
pub inputs: crate::defs::p775::play::serverbound::PlayerInputInputs,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for PlayerInput<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = crate::defs::p775::play::serverbound::PlayerInputInputs(r.read_u8()?);
Self { inputs: v1 }
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for PlayerInput<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_u8((*self).inputs.0);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for PlayerInput<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = crate::defs::p775::play::serverbound::PlayerInputInputs(
g.int_in(0, 255, &[]) as u8
);
Self { inputs: v1 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct PlayerLoaded<const V: i32> {}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for PlayerLoaded<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({ Self {} })
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for PlayerLoaded<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for PlayerLoaded<V> {
fn generate(g: &mut Gen) -> Self {
{ Self {} }
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct Pong<const V: i32> {
pub id: i32,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for Pong<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_i32()?;
Self { id: v1 }
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for Pong<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_i32((*self).id);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for Pong<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
Self { id: v1 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct DisplayedRecipe<const V: i32> {
pub recipe_id: i32,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for DisplayedRecipe<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_varint()?;
Self { recipe_id: v1 }
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for DisplayedRecipe<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).recipe_id);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for DisplayedRecipe<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
Self { recipe_id: v1 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct ResourcePackReceive<const V: i32> {
pub uuid: Uuid,
pub result: i32,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for ResourcePackReceive<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_uuid()?;
let v2 = r.read_varint()?;
Self {
uuid: v1,
result: v2,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for ResourcePackReceive<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_uuid(&(*self).uuid);
w.put_varint((*self).result);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for ResourcePackReceive<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.uuid();
let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
Self {
uuid: v1,
result: v2,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct SetBeaconEffect<const V: i32> {
pub primary_effect: Option<i32>,
pub secondary_effect: Option<i32>,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for SetBeaconEffect<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = if r.read_bool()? {
Some(r.read_varint()?)
} else {
None
};
let v2 = if r.read_bool()? {
Some(r.read_varint()?)
} else {
None
};
Self {
primary_effect: v1,
secondary_effect: v2,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for SetBeaconEffect<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
match &(*self).primary_effect {
Some(v1) => {
w.put_u8(1);
w.put_varint((*v1));
}
None => w.put_u8(0),
}
match &(*self).secondary_effect {
Some(v2) => {
w.put_u8(1);
w.put_varint((*v2));
}
None => w.put_u8(0),
}
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for SetBeaconEffect<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = if g.bool() {
Some((g.int_in(-2147483648, 2147483647, &[]) as i32))
} else {
None
};
let v2 = if g.bool() {
Some((g.int_in(-2147483648, 2147483647, &[]) as i32))
} else {
None
};
Self {
primary_effect: v1,
secondary_effect: v2,
}
}
}
}
#[cfg(feature = "v26_1")]
#[derive(Debug, Clone, PartialEq)]
pub struct SetCreativeSlot<const V: i32> {
pub slot: i16,
pub item: crate::defs::p775::types::UntrustedSlot,
}
#[cfg(feature = "v26_1")]
impl<const V: i32> Decode for SetCreativeSlot<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_i16()?;
let v2 = <crate::defs::p775::types::UntrustedSlot as Decode>::decode(r)?;
Self { slot: v1, item: v2 }
})
}
}
#[cfg(feature = "v26_1")]
impl<const V: i32> Encode for SetCreativeSlot<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_i16((*self).slot);
(*self).item.encode(w)?;
Ok(())
}
}
#[cfg(feature = "v26_1")]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for SetCreativeSlot<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = (g.int_in(-32768, 32767, &[]) as i16);
let v2 = <crate::defs::p775::types::UntrustedSlot as Generate>::generate(g);
Self { slot: v1, item: v2 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct SetGameRule<const V: i32> {
pub entries: Vec<crate::defs::p775::types::GameRule>,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for SetGameRule<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = {
let v2 = {
let c = r.read_varint()?;
r.check_count(i64::from(c), 2)?
};
let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
for _ in 0..v2 {
v3.push(<crate::defs::p775::types::GameRule as Decode>::decode(r)?);
}
v3
};
Self { entries: v1 }
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for SetGameRule<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_len_varint((*self).entries.len())?;
for v1 in (*self).entries.iter() {
(*v1).encode(w)?;
}
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for SetGameRule<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = {
let v2 = g.count();
let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
for _ in 0..v2 {
v3.push(<crate::defs::p775::types::GameRule as Generate>::generate(
g,
));
}
v3
};
Self { entries: v1 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct UpdateJigsawBlock<const V: i32> {
pub location: BlockPos,
pub name: ByteString,
pub target: ByteString,
pub pool: ByteString,
pub final_state: ByteString,
pub joint_type: ByteString,
pub selection_priority: i32,
pub placement_priority: i32,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for UpdateJigsawBlock<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = BlockPos::read(r, PositionLayout::Xzy)?;
let v2 = r.read_string()?;
let v3 = r.read_string()?;
let v4 = r.read_string()?;
let v5 = r.read_string()?;
let v6 = r.read_string()?;
let v7 = r.read_varint()?;
let v8 = r.read_varint()?;
Self {
location: v1,
name: v2,
target: v3,
pool: v4,
final_state: v5,
joint_type: v6,
selection_priority: v7,
placement_priority: v8,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for UpdateJigsawBlock<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
(*self).location.write(w, PositionLayout::Xzy)?;
w.put_string(&(*self).name)?;
w.put_string(&(*self).target)?;
w.put_string(&(*self).pool)?;
w.put_string(&(*self).final_state)?;
w.put_string(&(*self).joint_type)?;
w.put_varint((*self).selection_priority);
w.put_varint((*self).placement_priority);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for UpdateJigsawBlock<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.position();
let v2 = g.string();
let v3 = g.string();
let v4 = g.string();
let v5 = g.string();
let v6 = g.string();
let v7 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v8 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
Self {
location: v1,
name: v2,
target: v3,
pool: v4,
final_state: v5,
joint_type: v6,
selection_priority: v7,
placement_priority: v8,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
pub struct UpdateStructureBlockFlags(pub u8);
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl UpdateStructureBlockFlags {
pub const IGNORE_ENTITIES: Self = Self(0);
pub const SHOW_AIR: Self = Self(1);
pub const SHOW_BOUNDING_BOX: Self = Self(2);
pub const STRICT: Self = Self(3);
pub const fn name(self) -> Option<&'static str> {
match self.0 {
0 => Some("ignore_entities"),
1 => Some("show_air"),
2 => Some("show_bounding_box"),
3 => Some("strict"),
_ => None,
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl std::fmt::Debug for UpdateStructureBlockFlags {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.name() {
Some(n) => write!(f, "UpdateStructureBlockFlags::{n}"),
None => write!(f, "UpdateStructureBlockFlags({})", self.0),
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct UpdateStructureBlock<const V: i32> {
pub location: BlockPos,
pub action: i32,
pub mode: i32,
pub name: ByteString,
pub offset_x: i8,
pub offset_y: i8,
pub offset_z: i8,
pub size_x: i8,
pub size_y: i8,
pub size_z: i8,
pub mirror: i32,
pub rotation: i32,
pub metadata: ByteString,
pub integrity: f32,
pub seed: i32,
pub flags: crate::defs::p775::play::serverbound::UpdateStructureBlockFlags,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for UpdateStructureBlock<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = BlockPos::read(r, PositionLayout::Xzy)?;
let v2 = r.read_varint()?;
let v3 = r.read_varint()?;
let v4 = r.read_string()?;
let v5 = r.read_i8()?;
let v6 = r.read_i8()?;
let v7 = r.read_i8()?;
let v8 = r.read_i8()?;
let v9 = r.read_i8()?;
let v10 = r.read_i8()?;
let v11 = r.read_varint()?;
let v12 = r.read_varint()?;
let v13 = r.read_string()?;
let v14 = r.read_f32()?;
let v15 = r.read_varint()?;
let v16 = crate::defs::p775::play::serverbound::UpdateStructureBlockFlags(r.read_u8()?);
Self {
location: v1,
action: v2,
mode: v3,
name: v4,
offset_x: v5,
offset_y: v6,
offset_z: v7,
size_x: v8,
size_y: v9,
size_z: v10,
mirror: v11,
rotation: v12,
metadata: v13,
integrity: v14,
seed: v15,
flags: v16,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for UpdateStructureBlock<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
(*self).location.write(w, PositionLayout::Xzy)?;
w.put_varint((*self).action);
w.put_varint((*self).mode);
w.put_string(&(*self).name)?;
w.put_i8((*self).offset_x);
w.put_i8((*self).offset_y);
w.put_i8((*self).offset_z);
w.put_i8((*self).size_x);
w.put_i8((*self).size_y);
w.put_i8((*self).size_z);
w.put_varint((*self).mirror);
w.put_varint((*self).rotation);
w.put_string(&(*self).metadata)?;
w.put_f32((*self).integrity);
w.put_varint((*self).seed);
w.put_u8((*self).flags.0);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for UpdateStructureBlock<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.position();
let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v3 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v4 = g.string();
let v5 = (g.int_in(-128, 127, &[]) as i8);
let v6 = (g.int_in(-128, 127, &[]) as i8);
let v7 = (g.int_in(-128, 127, &[]) as i8);
let v8 = (g.int_in(-128, 127, &[]) as i8);
let v9 = (g.int_in(-128, 127, &[]) as i8);
let v10 = (g.int_in(-128, 127, &[]) as i8);
let v11 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v12 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v13 = g.string();
let v14 = g.f32();
let v15 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v16 = crate::defs::p775::play::serverbound::UpdateStructureBlockFlags(g.int_in(
0,
255,
&[0, 1, 2, 3],
)
as u8);
Self {
location: v1,
action: v2,
mode: v3,
name: v4,
offset_x: v5,
offset_y: v6,
offset_z: v7,
size_x: v8,
size_y: v9,
size_z: v10,
mirror: v11,
rotation: v12,
metadata: v13,
integrity: v14,
seed: v15,
flags: v16,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct SetTestBlock<const V: i32> {
pub position: BlockPos,
pub mode: i32,
pub message: ByteString,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for SetTestBlock<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = BlockPos::read(r, PositionLayout::Xzy)?;
let v2 = r.read_varint()?;
let v3 = r.read_string()?;
Self {
position: v1,
mode: v2,
message: v3,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for SetTestBlock<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
(*self).position.write(w, PositionLayout::Xzy)?;
w.put_varint((*self).mode);
w.put_string(&(*self).message)?;
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for SetTestBlock<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.position();
let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v3 = g.string();
Self {
position: v1,
mode: v2,
message: v3,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct UpdateSign<const V: i32> {
pub location: BlockPos,
pub is_front_text: bool,
pub text1: ByteString,
pub text2: ByteString,
pub text3: ByteString,
pub text4: ByteString,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for UpdateSign<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = BlockPos::read(r, PositionLayout::Xzy)?;
let v2 = r.read_bool()?;
let v3 = r.read_string()?;
let v4 = r.read_string()?;
let v5 = r.read_string()?;
let v6 = r.read_string()?;
Self {
location: v1,
is_front_text: v2,
text1: v3,
text2: v4,
text3: v5,
text4: v6,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for UpdateSign<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
(*self).location.write(w, PositionLayout::Xzy)?;
w.put_bool((*self).is_front_text);
w.put_string(&(*self).text1)?;
w.put_string(&(*self).text2)?;
w.put_string(&(*self).text3)?;
w.put_string(&(*self).text4)?;
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for UpdateSign<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.position();
let v2 = g.bool();
let v3 = g.string();
let v4 = g.string();
let v5 = g.string();
let v6 = g.string();
Self {
location: v1,
is_front_text: v2,
text1: v3,
text2: v4,
text3: v5,
text4: v6,
}
}
}
}
#[cfg(feature = "v26_1")]
#[derive(Debug, Clone, PartialEq)]
pub struct SpectateEntity<const V: i32> {
pub entity_id: i32,
}
#[cfg(feature = "v26_1")]
impl<const V: i32> Decode for SpectateEntity<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_varint()?;
Self { entity_id: v1 }
})
}
}
#[cfg(feature = "v26_1")]
impl<const V: i32> Encode for SpectateEntity<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).entity_id);
Ok(())
}
}
#[cfg(feature = "v26_1")]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for SpectateEntity<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
Self { entity_id: v1 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
pub struct ArmAnimationHand(pub i32);
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl ArmAnimationHand {
pub const MAIN_HAND: Self = Self(0);
pub const OFF_HAND: Self = Self(1);
pub const fn name(self) -> Option<&'static str> {
match self.0 {
0 => Some("main_hand"),
1 => Some("off_hand"),
_ => None,
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl std::fmt::Debug for ArmAnimationHand {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.name() {
Some(n) => write!(f, "ArmAnimationHand::{n}"),
None => write!(f, "ArmAnimationHand({})", self.0),
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct ArmAnimation<const V: i32> {
pub hand: crate::defs::p775::play::serverbound::ArmAnimationHand,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for ArmAnimation<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = crate::defs::p775::play::serverbound::ArmAnimationHand(r.read_varint()?);
Self { hand: v1 }
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for ArmAnimation<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).hand.0);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for ArmAnimation<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = crate::defs::p775::play::serverbound::ArmAnimationHand(g.int_in(
-2147483648,
2147483647,
&[0, 1],
) as i32);
Self { hand: v1 }
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct TestInstanceBlockActionData {
pub test: Option<ByteString>,
pub size: crate::defs::p775::types::Vec3i,
pub rotation: i32,
pub ignore_entities: bool,
pub status: i32,
pub error_message: Option<AnonNbt>,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct TestInstanceBlockAction<const V: i32> {
pub pos: BlockPos,
pub action: i32,
pub data: crate::defs::p775::play::serverbound::TestInstanceBlockActionData,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for TestInstanceBlockAction<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = BlockPos::read(r, PositionLayout::Xzy)?;
let v2 = r.read_varint()?;
let v3 = {
let v4 = if r.read_bool()? {
Some(r.read_string()?)
} else {
None
};
let v5 = <crate::defs::p775::types::Vec3i as Decode>::decode(r)?;
let v6 = r.read_varint()?;
let v7 = r.read_bool()?;
let v8 = r.read_varint()?;
let v9 = if r.read_bool()? {
Some(AnonNbt::read(r)?)
} else {
None
};
crate::defs::p775::play::serverbound::TestInstanceBlockActionData {
test: v4,
size: v5,
rotation: v6,
ignore_entities: v7,
status: v8,
error_message: v9,
}
};
Self {
pos: v1,
action: v2,
data: v3,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for TestInstanceBlockAction<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
(*self).pos.write(w, PositionLayout::Xzy)?;
w.put_varint((*self).action);
match &(*self).data.test {
Some(v1) => {
w.put_u8(1);
w.put_string(&(*v1))?;
}
None => w.put_u8(0),
}
(*self).data.size.encode(w)?;
w.put_varint((*self).data.rotation);
w.put_bool((*self).data.ignore_entities);
w.put_varint((*self).data.status);
match &(*self).data.error_message {
Some(v2) => {
w.put_u8(1);
(*v2).write(w);
}
None => w.put_u8(0),
}
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for TestInstanceBlockAction<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.position();
let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v3 = {
let v4 = if g.bool() { Some(g.string()) } else { None };
let v5 = <crate::defs::p775::types::Vec3i as Generate>::generate(g);
let v6 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v7 = g.bool();
let v8 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v9 = if g.bool() { Some(g.anon_nbt()) } else { None };
crate::defs::p775::play::serverbound::TestInstanceBlockActionData {
test: v4,
size: v5,
rotation: v6,
ignore_entities: v7,
status: v8,
error_message: v9,
}
};
Self {
pos: v1,
action: v2,
data: v3,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
pub struct BlockPlaceHand(pub i32);
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl BlockPlaceHand {
pub const MAIN_HAND: Self = Self(0);
pub const OFF_HAND: Self = Self(1);
pub const fn name(self) -> Option<&'static str> {
match self.0 {
0 => Some("main_hand"),
1 => Some("off_hand"),
_ => None,
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl std::fmt::Debug for BlockPlaceHand {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.name() {
Some(n) => write!(f, "BlockPlaceHand::{n}"),
None => write!(f, "BlockPlaceHand({})", self.0),
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct BlockPlace<const V: i32> {
pub hand: crate::defs::p775::play::serverbound::BlockPlaceHand,
pub location: BlockPos,
pub direction: i32,
pub cursor_x: f32,
pub cursor_y: f32,
pub cursor_z: f32,
pub inside_block: bool,
pub world_border_hit: bool,
pub sequence: i32,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for BlockPlace<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = crate::defs::p775::play::serverbound::BlockPlaceHand(r.read_varint()?);
let v2 = BlockPos::read(r, PositionLayout::Xzy)?;
let v3 = r.read_varint()?;
let v4 = r.read_f32()?;
let v5 = r.read_f32()?;
let v6 = r.read_f32()?;
let v7 = r.read_bool()?;
let v8 = r.read_bool()?;
let v9 = r.read_varint()?;
Self {
hand: v1,
location: v2,
direction: v3,
cursor_x: v4,
cursor_y: v5,
cursor_z: v6,
inside_block: v7,
world_border_hit: v8,
sequence: v9,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for BlockPlace<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).hand.0);
(*self).location.write(w, PositionLayout::Xzy)?;
w.put_varint((*self).direction);
w.put_f32((*self).cursor_x);
w.put_f32((*self).cursor_y);
w.put_f32((*self).cursor_z);
w.put_bool((*self).inside_block);
w.put_bool((*self).world_border_hit);
w.put_varint((*self).sequence);
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for BlockPlace<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = crate::defs::p775::play::serverbound::BlockPlaceHand(g.int_in(
-2147483648,
2147483647,
&[0, 1],
) as i32);
let v2 = g.position();
let v3 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v4 = g.f32();
let v5 = g.f32();
let v6 = g.f32();
let v7 = g.bool();
let v8 = g.bool();
let v9 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
Self {
hand: v1,
location: v2,
direction: v3,
cursor_x: v4,
cursor_y: v5,
cursor_z: v6,
inside_block: v7,
world_border_hit: v8,
sequence: v9,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
pub struct UseItemHand(pub i32);
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl UseItemHand {
pub const MAIN_HAND: Self = Self(0);
pub const OFF_HAND: Self = Self(1);
pub const fn name(self) -> Option<&'static str> {
match self.0 {
0 => Some("main_hand"),
1 => Some("off_hand"),
_ => None,
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl std::fmt::Debug for UseItemHand {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.name() {
Some(n) => write!(f, "UseItemHand::{n}"),
None => write!(f, "UseItemHand({})", self.0),
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct UseItem<const V: i32> {
pub hand: crate::defs::p775::play::serverbound::UseItemHand,
pub sequence: i32,
pub rotation: crate::defs::p775::types::Vec2f,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for UseItem<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = crate::defs::p775::play::serverbound::UseItemHand(r.read_varint()?);
let v2 = r.read_varint()?;
let v3 = <crate::defs::p775::types::Vec2f as Decode>::decode(r)?;
Self {
hand: v1,
sequence: v2,
rotation: v3,
}
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for UseItem<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).hand.0);
w.put_varint((*self).sequence);
(*self).rotation.encode(w)?;
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for UseItem<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = crate::defs::p775::play::serverbound::UseItemHand(g.int_in(
-2147483648,
2147483647,
&[0, 1],
) as i32);
let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v3 = <crate::defs::p775::types::Vec2f as Generate>::generate(g);
Self {
hand: v1,
sequence: v2,
rotation: v3,
}
}
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[derive(Debug, Clone, PartialEq)]
pub struct CustomClickAction<const V: i32> {
pub id: ByteString,
pub nbt: Option<AnonNbt>,
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Decode for CustomClickAction<V> {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1 = r.read_string()?;
let v2 = if r.read_bool()? {
Some(AnonNbt::read(r)?)
} else {
None
};
Self { id: v1, nbt: v2 }
})
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
impl<const V: i32> Encode for CustomClickAction<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_string(&(*self).id)?;
match &(*self).nbt {
Some(v1) => {
w.put_u8(1);
(*v1).write(w);
}
None => w.put_u8(0),
}
Ok(())
}
}
#[cfg(any(feature = "v26_1", feature = "v26_2"))]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for CustomClickAction<V> {
fn generate(g: &mut Gen) -> Self {
{
let v1 = g.string();
let v2 = if g.bool() { Some(g.anon_nbt()) } else { None };
Self { id: v1, nbt: v2 }
}
}
}