#![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(feature = "v26_3")]
#[derive(Debug, Clone, PartialEq)]
pub struct PostEffects<const V: i32> {
pub effects: Vec<ByteString>,
}
#[cfg(feature = "v26_3")]
impl<const V: i32> Decode for PostEffects<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(r.read_string()?);
}
v3
};
Self { effects: v1 }
})
}
}
#[cfg(feature = "v26_3")]
impl<const V: i32> Encode for PostEffects<V> {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_len_varint((*self).effects.len())?;
for v1 in (*self).effects.iter() {
w.put_string(&(*v1))?;
}
Ok(())
}
}
#[cfg(feature = "v26_3")]
#[cfg(feature = "testgen")]
impl<const V: i32> Generate for PostEffects<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(g.string());
}
v3
};
Self { effects: v1 }
}
}
}