#![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::RawNbt;
use crate::packet::{Direction, PacketSet, RawPacket, State};
#[cfg(feature = "testgen")]
use crate::testgen::{Gen, Generate};
use crate::types::{BlockPos, ByteString, PositionLayout, Uuid};
use crate::v1_16_5::types;
use bytes::{BufMut, Bytes, BytesMut};
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
pub struct SetDifficultyNewDifficulty(pub u8);
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,
}
}
}
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),
}
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
pub struct ClientCommandActionId(pub i32);
impl ClientCommandActionId {
pub const PERFORM_RESPAWN: Self = Self(0);
pub const REQUEST_STATS: Self = Self(1);
pub const fn name(self) -> Option<&'static str> {
match self.0 {
0 => Some("perform_respawn"),
1 => Some("request_stats"),
_ => None,
}
}
}
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),
}
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
pub struct EntityActionActionId(pub i32);
impl EntityActionActionId {
pub const START_SNEAKING: Self = Self(0);
pub const STOP_SNEAKING: Self = Self(1);
pub const STOP_SLEEPING: Self = Self(2);
pub const START_SPRINTING: Self = Self(3);
pub const STOP_SPRINTING: Self = Self(4);
pub const START_RIDING_JUMP: Self = Self(5);
pub const STOP_RIDING_JUMP: Self = Self(6);
pub const OPEN_INVENTORY: Self = Self(7);
pub const START_FALL_FLYING: Self = Self(8);
pub const fn name(self) -> Option<&'static str> {
match self.0 {
0 => Some("start_sneaking"),
1 => Some("stop_sneaking"),
2 => Some("stop_sleeping"),
3 => Some("start_sprinting"),
4 => Some("stop_sprinting"),
5 => Some("start_riding_jump"),
6 => Some("stop_riding_jump"),
7 => Some("open_inventory"),
8 => Some("start_fall_flying"),
_ => None,
}
}
}
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),
}
}
}
pub mod id {
pub const TELEPORT_CONFIRM: i32 = 0x00;
pub const QUERY_BLOCK_NBT: i32 = 0x01;
pub const SET_DIFFICULTY: i32 = 0x02;
pub const CHAT: i32 = 0x03;
pub const CLIENT_COMMAND: i32 = 0x04;
pub const SETTINGS: i32 = 0x05;
pub const TAB_COMPLETE: i32 = 0x06;
pub const TRANSACTION: i32 = 0x07;
pub const ENCHANT_ITEM: i32 = 0x08;
pub const WINDOW_CLICK: i32 = 0x09;
pub const CLOSE_WINDOW: i32 = 0x0a;
pub const CUSTOM_PAYLOAD: i32 = 0x0b;
pub const EDIT_BOOK: i32 = 0x0c;
pub const QUERY_ENTITY_NBT: i32 = 0x0d;
pub const USE_ENTITY: i32 = 0x0e;
pub const GENERATE_STRUCTURE: i32 = 0x0f;
pub const KEEP_ALIVE: i32 = 0x10;
pub const LOCK_DIFFICULTY: i32 = 0x11;
pub const POSITION: i32 = 0x12;
pub const POSITION_LOOK: i32 = 0x13;
pub const LOOK: i32 = 0x14;
pub const FLYING: i32 = 0x15;
pub const VEHICLE_MOVE: i32 = 0x16;
pub const STEER_BOAT: i32 = 0x17;
pub const PICK_ITEM: i32 = 0x18;
pub const CRAFT_RECIPE_REQUEST: i32 = 0x19;
pub const ABILITIES: i32 = 0x1a;
pub const BLOCK_DIG: i32 = 0x1b;
pub const ENTITY_ACTION: i32 = 0x1c;
pub const STEER_VEHICLE: i32 = 0x1d;
pub const RECIPE_BOOK: i32 = 0x1e;
pub const DISPLAYED_RECIPE: i32 = 0x1f;
pub const NAME_ITEM: i32 = 0x20;
pub const RESOURCE_PACK_RECEIVE: i32 = 0x21;
pub const ADVANCEMENT_TAB: i32 = 0x22;
pub const SELECT_TRADE: i32 = 0x23;
pub const SET_BEACON_EFFECT: i32 = 0x24;
pub const HELD_ITEM_SLOT: i32 = 0x25;
pub const UPDATE_COMMAND_BLOCK: i32 = 0x26;
pub const UPDATE_COMMAND_BLOCK_MINECART: i32 = 0x27;
pub const SET_CREATIVE_SLOT: i32 = 0x28;
pub const UPDATE_JIGSAW_BLOCK: i32 = 0x29;
pub const UPDATE_STRUCTURE_BLOCK: i32 = 0x2a;
pub const UPDATE_SIGN: i32 = 0x2b;
pub const ARM_ANIMATION: i32 = 0x2c;
pub const SPECTATE: i32 = 0x2d;
pub const BLOCK_PLACE: i32 = 0x2e;
pub const USE_ITEM: i32 = 0x2f;
}
#[derive(Debug, Clone, PartialEq)]
pub struct TeleportConfirm {
pub teleport_id: i32,
}
impl crate::packet::Packet for TeleportConfirm {
const ID: i32 = id::TELEPORT_CONFIRM;
const NAME: &'static str = "teleport_confirm";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for TeleportConfirm {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1338 = r.read_varint()?;
TeleportConfirm { teleport_id: v1338 }
})
}
}
impl Encode for TeleportConfirm {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).teleport_id);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for TeleportConfirm {
fn generate(g: &mut Gen) -> Self {
{
let v1339 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
TeleportConfirm { teleport_id: v1339 }
}
}
}
impl From<TeleportConfirm> for ServerboundPlayPacket {
fn from(p: TeleportConfirm) -> Self {
Self::TeleportConfirm(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct QueryBlockNbt {
pub transaction_id: i32,
pub location: BlockPos,
}
impl crate::packet::Packet for QueryBlockNbt {
const ID: i32 = id::QUERY_BLOCK_NBT;
const NAME: &'static str = "query_block_nbt";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for QueryBlockNbt {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1340 = r.read_varint()?;
let v1341 = BlockPos::read(r, PositionLayout::Xzy)?;
QueryBlockNbt {
transaction_id: v1340,
location: v1341,
}
})
}
}
impl Encode for QueryBlockNbt {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).transaction_id);
(*self).location.write(w, PositionLayout::Xzy)?;
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for QueryBlockNbt {
fn generate(g: &mut Gen) -> Self {
{
let v1342 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1343 = g.position();
QueryBlockNbt {
transaction_id: v1342,
location: v1343,
}
}
}
}
impl From<QueryBlockNbt> for ServerboundPlayPacket {
fn from(p: QueryBlockNbt) -> Self {
Self::QueryBlockNbt(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct SetDifficulty {
pub new_difficulty: SetDifficultyNewDifficulty,
}
impl crate::packet::Packet for SetDifficulty {
const ID: i32 = id::SET_DIFFICULTY;
const NAME: &'static str = "set_difficulty";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for SetDifficulty {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1344 = SetDifficultyNewDifficulty(r.read_u8()?);
SetDifficulty {
new_difficulty: v1344,
}
})
}
}
impl Encode for SetDifficulty {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_u8((*self).new_difficulty.0);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for SetDifficulty {
fn generate(g: &mut Gen) -> Self {
{
let v1345 = SetDifficultyNewDifficulty(g.int_in(0, 255, &[0, 1, 2, 3]) as u8);
SetDifficulty {
new_difficulty: v1345,
}
}
}
}
impl From<SetDifficulty> for ServerboundPlayPacket {
fn from(p: SetDifficulty) -> Self {
Self::SetDifficulty(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Chat {
pub message: ByteString,
}
impl crate::packet::Packet for Chat {
const ID: i32 = id::CHAT;
const NAME: &'static str = "chat";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for Chat {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1346 = r.read_string()?;
Chat { message: v1346 }
})
}
}
impl Encode for Chat {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_string(&(*self).message)?;
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for Chat {
fn generate(g: &mut Gen) -> Self {
{
let v1347 = g.string();
Chat { message: v1347 }
}
}
}
impl From<Chat> for ServerboundPlayPacket {
fn from(p: Chat) -> Self {
Self::Chat(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct ClientCommand {
pub action_id: ClientCommandActionId,
}
impl crate::packet::Packet for ClientCommand {
const ID: i32 = id::CLIENT_COMMAND;
const NAME: &'static str = "client_command";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for ClientCommand {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1348 = ClientCommandActionId(r.read_varint()?);
ClientCommand { action_id: v1348 }
})
}
}
impl Encode for ClientCommand {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).action_id.0);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for ClientCommand {
fn generate(g: &mut Gen) -> Self {
{
let v1349 = ClientCommandActionId(g.int_in(-2147483648, 2147483647, &[0, 1]) as i32);
ClientCommand { action_id: v1349 }
}
}
}
impl From<ClientCommand> for ServerboundPlayPacket {
fn from(p: ClientCommand) -> Self {
Self::ClientCommand(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Settings {
pub locale: ByteString,
pub view_distance: i8,
pub chat_flags: i32,
pub chat_colors: bool,
pub skin_parts: u8,
pub main_hand: i32,
}
impl crate::packet::Packet for Settings {
const ID: i32 = id::SETTINGS;
const NAME: &'static str = "settings";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for Settings {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1350 = r.read_string()?;
let v1351 = r.read_i8()?;
let v1352 = r.read_varint()?;
let v1353 = r.read_bool()?;
let v1354 = r.read_u8()?;
let v1355 = r.read_varint()?;
Settings {
locale: v1350,
view_distance: v1351,
chat_flags: v1352,
chat_colors: v1353,
skin_parts: v1354,
main_hand: v1355,
}
})
}
}
impl Encode for Settings {
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);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for Settings {
fn generate(g: &mut Gen) -> Self {
{
let v1356 = g.string();
let v1357 = (g.int_in(-128, 127, &[]) as i8);
let v1358 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1359 = g.bool();
let v1360 = (g.int_in(0, 255, &[]) as u8);
let v1361 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
Settings {
locale: v1356,
view_distance: v1357,
chat_flags: v1358,
chat_colors: v1359,
skin_parts: v1360,
main_hand: v1361,
}
}
}
}
impl From<Settings> for ServerboundPlayPacket {
fn from(p: Settings) -> Self {
Self::Settings(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct TabComplete {
pub transaction_id: i32,
pub text: ByteString,
}
impl crate::packet::Packet for TabComplete {
const ID: i32 = id::TAB_COMPLETE;
const NAME: &'static str = "tab_complete";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for TabComplete {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1362 = r.read_varint()?;
let v1363 = r.read_string()?;
TabComplete {
transaction_id: v1362,
text: v1363,
}
})
}
}
impl Encode for TabComplete {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).transaction_id);
w.put_string(&(*self).text)?;
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for TabComplete {
fn generate(g: &mut Gen) -> Self {
{
let v1364 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1365 = g.string();
TabComplete {
transaction_id: v1364,
text: v1365,
}
}
}
}
impl From<TabComplete> for ServerboundPlayPacket {
fn from(p: TabComplete) -> Self {
Self::TabComplete(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Transaction {
pub window_id: i8,
pub action: i16,
pub accepted: bool,
}
impl crate::packet::Packet for Transaction {
const ID: i32 = id::TRANSACTION;
const NAME: &'static str = "transaction";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for Transaction {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1366 = r.read_i8()?;
let v1367 = r.read_i16()?;
let v1368 = r.read_bool()?;
Transaction {
window_id: v1366,
action: v1367,
accepted: v1368,
}
})
}
}
impl Encode for Transaction {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_i8((*self).window_id);
w.put_i16((*self).action);
w.put_bool((*self).accepted);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for Transaction {
fn generate(g: &mut Gen) -> Self {
{
let v1369 = (g.int_in(-128, 127, &[]) as i8);
let v1370 = (g.int_in(-32768, 32767, &[]) as i16);
let v1371 = g.bool();
Transaction {
window_id: v1369,
action: v1370,
accepted: v1371,
}
}
}
}
impl From<Transaction> for ServerboundPlayPacket {
fn from(p: Transaction) -> Self {
Self::Transaction(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct EnchantItem {
pub window_id: i8,
pub enchantment: i8,
}
impl crate::packet::Packet for EnchantItem {
const ID: i32 = id::ENCHANT_ITEM;
const NAME: &'static str = "enchant_item";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for EnchantItem {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1372 = r.read_i8()?;
let v1373 = r.read_i8()?;
EnchantItem {
window_id: v1372,
enchantment: v1373,
}
})
}
}
impl Encode for EnchantItem {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_i8((*self).window_id);
w.put_i8((*self).enchantment);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for EnchantItem {
fn generate(g: &mut Gen) -> Self {
{
let v1374 = (g.int_in(-128, 127, &[]) as i8);
let v1375 = (g.int_in(-128, 127, &[]) as i8);
EnchantItem {
window_id: v1374,
enchantment: v1375,
}
}
}
}
impl From<EnchantItem> for ServerboundPlayPacket {
fn from(p: EnchantItem) -> Self {
Self::EnchantItem(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct WindowClick {
pub window_id: u8,
pub slot: i16,
pub mouse_button: i8,
pub action: i16,
pub mode: i8,
pub item: types::Slot,
}
impl crate::packet::Packet for WindowClick {
const ID: i32 = id::WINDOW_CLICK;
const NAME: &'static str = "window_click";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for WindowClick {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1376 = r.read_u8()?;
let v1377 = r.read_i16()?;
let v1378 = r.read_i8()?;
let v1379 = r.read_i16()?;
let v1380 = r.read_i8()?;
let v1381 = <types::Slot as Decode>::decode(r)?;
WindowClick {
window_id: v1376,
slot: v1377,
mouse_button: v1378,
action: v1379,
mode: v1380,
item: v1381,
}
})
}
}
impl Encode for WindowClick {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_u8((*self).window_id);
w.put_i16((*self).slot);
w.put_i8((*self).mouse_button);
w.put_i16((*self).action);
w.put_i8((*self).mode);
(*self).item.encode(w)?;
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for WindowClick {
fn generate(g: &mut Gen) -> Self {
{
let v1382 = (g.int_in(0, 255, &[]) as u8);
let v1383 = (g.int_in(-32768, 32767, &[]) as i16);
let v1384 = (g.int_in(-128, 127, &[]) as i8);
let v1385 = (g.int_in(-32768, 32767, &[]) as i16);
let v1386 = (g.int_in(-128, 127, &[]) as i8);
let v1387 = <types::Slot as Generate>::generate(g);
WindowClick {
window_id: v1382,
slot: v1383,
mouse_button: v1384,
action: v1385,
mode: v1386,
item: v1387,
}
}
}
}
impl From<WindowClick> for ServerboundPlayPacket {
fn from(p: WindowClick) -> Self {
Self::WindowClick(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct CloseWindow {
pub window_id: u8,
}
impl crate::packet::Packet for CloseWindow {
const ID: i32 = id::CLOSE_WINDOW;
const NAME: &'static str = "close_window";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for CloseWindow {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1388 = r.read_u8()?;
CloseWindow { window_id: v1388 }
})
}
}
impl Encode for CloseWindow {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_u8((*self).window_id);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for CloseWindow {
fn generate(g: &mut Gen) -> Self {
{
let v1389 = (g.int_in(0, 255, &[]) as u8);
CloseWindow { window_id: v1389 }
}
}
}
impl From<CloseWindow> for ServerboundPlayPacket {
fn from(p: CloseWindow) -> Self {
Self::CloseWindow(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct CustomPayload {
pub channel: ByteString,
pub data: Bytes,
}
impl crate::packet::Packet for CustomPayload {
const ID: i32 = id::CUSTOM_PAYLOAD;
const NAME: &'static str = "custom_payload";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for CustomPayload {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1390 = r.read_string()?;
let v1391 = r.read_rest();
CustomPayload {
channel: v1390,
data: v1391,
}
})
}
}
impl Encode for CustomPayload {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_string(&(*self).channel)?;
w.put_slice(&(*self).data);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for CustomPayload {
fn generate(g: &mut Gen) -> Self {
{
let v1392 = g.string();
let v1393 = g.bytes();
CustomPayload {
channel: v1392,
data: v1393,
}
}
}
}
impl From<CustomPayload> for ServerboundPlayPacket {
fn from(p: CustomPayload) -> Self {
Self::CustomPayload(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct EditBook {
pub new_book: types::Slot,
pub signing: bool,
pub hand: i32,
}
impl crate::packet::Packet for EditBook {
const ID: i32 = id::EDIT_BOOK;
const NAME: &'static str = "edit_book";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for EditBook {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1394 = <types::Slot as Decode>::decode(r)?;
let v1395 = r.read_bool()?;
let v1396 = r.read_varint()?;
EditBook {
new_book: v1394,
signing: v1395,
hand: v1396,
}
})
}
}
impl Encode for EditBook {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
(*self).new_book.encode(w)?;
w.put_bool((*self).signing);
w.put_varint((*self).hand);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for EditBook {
fn generate(g: &mut Gen) -> Self {
{
let v1397 = <types::Slot as Generate>::generate(g);
let v1398 = g.bool();
let v1399 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
EditBook {
new_book: v1397,
signing: v1398,
hand: v1399,
}
}
}
}
impl From<EditBook> for ServerboundPlayPacket {
fn from(p: EditBook) -> Self {
Self::EditBook(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct QueryEntityNbt {
pub transaction_id: i32,
pub entity_id: i32,
}
impl crate::packet::Packet for QueryEntityNbt {
const ID: i32 = id::QUERY_ENTITY_NBT;
const NAME: &'static str = "query_entity_nbt";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for QueryEntityNbt {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1400 = r.read_varint()?;
let v1401 = r.read_varint()?;
QueryEntityNbt {
transaction_id: v1400,
entity_id: v1401,
}
})
}
}
impl Encode for QueryEntityNbt {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).transaction_id);
w.put_varint((*self).entity_id);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for QueryEntityNbt {
fn generate(g: &mut Gen) -> Self {
{
let v1402 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1403 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
QueryEntityNbt {
transaction_id: v1402,
entity_id: v1403,
}
}
}
}
impl From<QueryEntityNbt> for ServerboundPlayPacket {
fn from(p: QueryEntityNbt) -> Self {
Self::QueryEntityNbt(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct UseEntity {
pub target: i32,
pub mouse: i32,
pub x: Option<f32>,
pub y: Option<f32>,
pub z: Option<f32>,
pub hand: Option<i32>,
pub sneaking: bool,
}
impl crate::packet::Packet for UseEntity {
const ID: i32 = id::USE_ENTITY;
const NAME: &'static str = "use_entity";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for UseEntity {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1404 = r.read_varint()?;
let v1405 = r.read_varint()?;
let v1406 = if (v1405 == 2) {
Some(r.read_f32()?)
} else {
None
};
let v1407 = if (v1405 == 2) {
Some(r.read_f32()?)
} else {
None
};
let v1408 = if (v1405 == 2) {
Some(r.read_f32()?)
} else {
None
};
let v1409 = if (v1405 == 0) || (v1405 == 2) {
Some(r.read_varint()?)
} else {
None
};
let v1410 = r.read_bool()?;
UseEntity {
target: v1404,
mouse: v1405,
x: v1406,
y: v1407,
z: v1408,
hand: v1409,
sneaking: v1410,
}
})
}
}
impl Encode for UseEntity {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).target);
w.put_varint((*self).mouse);
match (&(*self).x, ((*self).mouse == 2)) {
(Some(v1411), true) => {
w.put_f32((*v1411));
}
(None, false) => {}
_ => return Err(EncodeError::SwitchMismatch("play.serverbound.use_entity.x")),
}
match (&(*self).y, ((*self).mouse == 2)) {
(Some(v1412), true) => {
w.put_f32((*v1412));
}
(None, false) => {}
_ => return Err(EncodeError::SwitchMismatch("play.serverbound.use_entity.y")),
}
match (&(*self).z, ((*self).mouse == 2)) {
(Some(v1413), true) => {
w.put_f32((*v1413));
}
(None, false) => {}
_ => return Err(EncodeError::SwitchMismatch("play.serverbound.use_entity.z")),
}
match (&(*self).hand, ((*self).mouse == 0) || ((*self).mouse == 2)) {
(Some(v1414), true) => {
w.put_varint((*v1414));
}
(None, false) => {}
_ => {
return Err(EncodeError::SwitchMismatch(
"play.serverbound.use_entity.hand",
));
}
}
w.put_bool((*self).sneaking);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for UseEntity {
fn generate(g: &mut Gen) -> Self {
{
let v1415 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1416 = (g.int_in(-2147483648, 2147483647, &[2, 2, 2, 0, 2]) as i32);
let v1417 = if (v1416 == 2) { Some(g.f32()) } else { None };
let v1418 = if (v1416 == 2) { Some(g.f32()) } else { None };
let v1419 = if (v1416 == 2) { Some(g.f32()) } else { None };
let v1420 = if (v1416 == 0) || (v1416 == 2) {
Some((g.int_in(-2147483648, 2147483647, &[]) as i32))
} else {
None
};
let v1421 = g.bool();
UseEntity {
target: v1415,
mouse: v1416,
x: v1417,
y: v1418,
z: v1419,
hand: v1420,
sneaking: v1421,
}
}
}
}
impl From<UseEntity> for ServerboundPlayPacket {
fn from(p: UseEntity) -> Self {
Self::UseEntity(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GenerateStructure {
pub location: BlockPos,
pub levels: i32,
pub keep_jigsaws: bool,
}
impl crate::packet::Packet for GenerateStructure {
const ID: i32 = id::GENERATE_STRUCTURE;
const NAME: &'static str = "generate_structure";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for GenerateStructure {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1422 = BlockPos::read(r, PositionLayout::Xzy)?;
let v1423 = r.read_varint()?;
let v1424 = r.read_bool()?;
GenerateStructure {
location: v1422,
levels: v1423,
keep_jigsaws: v1424,
}
})
}
}
impl Encode for GenerateStructure {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
(*self).location.write(w, PositionLayout::Xzy)?;
w.put_varint((*self).levels);
w.put_bool((*self).keep_jigsaws);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for GenerateStructure {
fn generate(g: &mut Gen) -> Self {
{
let v1425 = g.position();
let v1426 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1427 = g.bool();
GenerateStructure {
location: v1425,
levels: v1426,
keep_jigsaws: v1427,
}
}
}
}
impl From<GenerateStructure> for ServerboundPlayPacket {
fn from(p: GenerateStructure) -> Self {
Self::GenerateStructure(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct KeepAlive {
pub keep_alive_id: i64,
}
impl crate::packet::Packet for KeepAlive {
const ID: i32 = id::KEEP_ALIVE;
const NAME: &'static str = "keep_alive";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for KeepAlive {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1428 = r.read_i64()?;
KeepAlive {
keep_alive_id: v1428,
}
})
}
}
impl Encode for KeepAlive {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_i64((*self).keep_alive_id);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for KeepAlive {
fn generate(g: &mut Gen) -> Self {
{
let v1429 = g.i64();
KeepAlive {
keep_alive_id: v1429,
}
}
}
}
impl From<KeepAlive> for ServerboundPlayPacket {
fn from(p: KeepAlive) -> Self {
Self::KeepAlive(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct LockDifficulty {
pub locked: bool,
}
impl crate::packet::Packet for LockDifficulty {
const ID: i32 = id::LOCK_DIFFICULTY;
const NAME: &'static str = "lock_difficulty";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for LockDifficulty {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1430 = r.read_bool()?;
LockDifficulty { locked: v1430 }
})
}
}
impl Encode for LockDifficulty {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_bool((*self).locked);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for LockDifficulty {
fn generate(g: &mut Gen) -> Self {
{
let v1431 = g.bool();
LockDifficulty { locked: v1431 }
}
}
}
impl From<LockDifficulty> for ServerboundPlayPacket {
fn from(p: LockDifficulty) -> Self {
Self::LockDifficulty(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Position {
pub x: f64,
pub y: f64,
pub z: f64,
pub on_ground: bool,
}
impl crate::packet::Packet for Position {
const ID: i32 = id::POSITION;
const NAME: &'static str = "position";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for Position {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1432 = r.read_f64()?;
let v1433 = r.read_f64()?;
let v1434 = r.read_f64()?;
let v1435 = r.read_bool()?;
Position {
x: v1432,
y: v1433,
z: v1434,
on_ground: v1435,
}
})
}
}
impl Encode for Position {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_f64((*self).x);
w.put_f64((*self).y);
w.put_f64((*self).z);
w.put_bool((*self).on_ground);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for Position {
fn generate(g: &mut Gen) -> Self {
{
let v1436 = g.f64();
let v1437 = g.f64();
let v1438 = g.f64();
let v1439 = g.bool();
Position {
x: v1436,
y: v1437,
z: v1438,
on_ground: v1439,
}
}
}
}
impl From<Position> for ServerboundPlayPacket {
fn from(p: Position) -> Self {
Self::Position(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct PositionLook {
pub x: f64,
pub y: f64,
pub z: f64,
pub yaw: f32,
pub pitch: f32,
pub on_ground: bool,
}
impl crate::packet::Packet for PositionLook {
const ID: i32 = id::POSITION_LOOK;
const NAME: &'static str = "position_look";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for PositionLook {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1440 = r.read_f64()?;
let v1441 = r.read_f64()?;
let v1442 = r.read_f64()?;
let v1443 = r.read_f32()?;
let v1444 = r.read_f32()?;
let v1445 = r.read_bool()?;
PositionLook {
x: v1440,
y: v1441,
z: v1442,
yaw: v1443,
pitch: v1444,
on_ground: v1445,
}
})
}
}
impl Encode for PositionLook {
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(feature = "testgen")]
impl Generate for PositionLook {
fn generate(g: &mut Gen) -> Self {
{
let v1446 = g.f64();
let v1447 = g.f64();
let v1448 = g.f64();
let v1449 = g.f32();
let v1450 = g.f32();
let v1451 = g.bool();
PositionLook {
x: v1446,
y: v1447,
z: v1448,
yaw: v1449,
pitch: v1450,
on_ground: v1451,
}
}
}
}
impl From<PositionLook> for ServerboundPlayPacket {
fn from(p: PositionLook) -> Self {
Self::PositionLook(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Look {
pub yaw: f32,
pub pitch: f32,
pub on_ground: bool,
}
impl crate::packet::Packet for Look {
const ID: i32 = id::LOOK;
const NAME: &'static str = "look";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for Look {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1452 = r.read_f32()?;
let v1453 = r.read_f32()?;
let v1454 = r.read_bool()?;
Look {
yaw: v1452,
pitch: v1453,
on_ground: v1454,
}
})
}
}
impl Encode for Look {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_f32((*self).yaw);
w.put_f32((*self).pitch);
w.put_bool((*self).on_ground);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for Look {
fn generate(g: &mut Gen) -> Self {
{
let v1455 = g.f32();
let v1456 = g.f32();
let v1457 = g.bool();
Look {
yaw: v1455,
pitch: v1456,
on_ground: v1457,
}
}
}
}
impl From<Look> for ServerboundPlayPacket {
fn from(p: Look) -> Self {
Self::Look(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Flying {
pub on_ground: bool,
}
impl crate::packet::Packet for Flying {
const ID: i32 = id::FLYING;
const NAME: &'static str = "flying";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for Flying {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1458 = r.read_bool()?;
Flying { on_ground: v1458 }
})
}
}
impl Encode for Flying {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_bool((*self).on_ground);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for Flying {
fn generate(g: &mut Gen) -> Self {
{
let v1459 = g.bool();
Flying { on_ground: v1459 }
}
}
}
impl From<Flying> for ServerboundPlayPacket {
fn from(p: Flying) -> Self {
Self::Flying(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct VehicleMove {
pub x: f64,
pub y: f64,
pub z: f64,
pub yaw: f32,
pub pitch: f32,
}
impl crate::packet::Packet for VehicleMove {
const ID: i32 = id::VEHICLE_MOVE;
const NAME: &'static str = "vehicle_move";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for VehicleMove {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1460 = r.read_f64()?;
let v1461 = r.read_f64()?;
let v1462 = r.read_f64()?;
let v1463 = r.read_f32()?;
let v1464 = r.read_f32()?;
VehicleMove {
x: v1460,
y: v1461,
z: v1462,
yaw: v1463,
pitch: v1464,
}
})
}
}
impl Encode for VehicleMove {
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);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for VehicleMove {
fn generate(g: &mut Gen) -> Self {
{
let v1465 = g.f64();
let v1466 = g.f64();
let v1467 = g.f64();
let v1468 = g.f32();
let v1469 = g.f32();
VehicleMove {
x: v1465,
y: v1466,
z: v1467,
yaw: v1468,
pitch: v1469,
}
}
}
}
impl From<VehicleMove> for ServerboundPlayPacket {
fn from(p: VehicleMove) -> Self {
Self::VehicleMove(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct SteerBoat {
pub left_paddle: bool,
pub right_paddle: bool,
}
impl crate::packet::Packet for SteerBoat {
const ID: i32 = id::STEER_BOAT;
const NAME: &'static str = "steer_boat";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for SteerBoat {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1470 = r.read_bool()?;
let v1471 = r.read_bool()?;
SteerBoat {
left_paddle: v1470,
right_paddle: v1471,
}
})
}
}
impl Encode for SteerBoat {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_bool((*self).left_paddle);
w.put_bool((*self).right_paddle);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for SteerBoat {
fn generate(g: &mut Gen) -> Self {
{
let v1472 = g.bool();
let v1473 = g.bool();
SteerBoat {
left_paddle: v1472,
right_paddle: v1473,
}
}
}
}
impl From<SteerBoat> for ServerboundPlayPacket {
fn from(p: SteerBoat) -> Self {
Self::SteerBoat(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct PickItem {
pub slot: i32,
}
impl crate::packet::Packet for PickItem {
const ID: i32 = id::PICK_ITEM;
const NAME: &'static str = "pick_item";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for PickItem {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1474 = r.read_varint()?;
PickItem { slot: v1474 }
})
}
}
impl Encode for PickItem {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).slot);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for PickItem {
fn generate(g: &mut Gen) -> Self {
{
let v1475 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
PickItem { slot: v1475 }
}
}
}
impl From<PickItem> for ServerboundPlayPacket {
fn from(p: PickItem) -> Self {
Self::PickItem(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct CraftRecipeRequest {
pub window_id: i8,
pub recipe: ByteString,
pub make_all: bool,
}
impl crate::packet::Packet for CraftRecipeRequest {
const ID: i32 = id::CRAFT_RECIPE_REQUEST;
const NAME: &'static str = "craft_recipe_request";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for CraftRecipeRequest {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1476 = r.read_i8()?;
let v1477 = r.read_string()?;
let v1478 = r.read_bool()?;
CraftRecipeRequest {
window_id: v1476,
recipe: v1477,
make_all: v1478,
}
})
}
}
impl Encode for CraftRecipeRequest {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_i8((*self).window_id);
w.put_string(&(*self).recipe)?;
w.put_bool((*self).make_all);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for CraftRecipeRequest {
fn generate(g: &mut Gen) -> Self {
{
let v1479 = (g.int_in(-128, 127, &[]) as i8);
let v1480 = g.string();
let v1481 = g.bool();
CraftRecipeRequest {
window_id: v1479,
recipe: v1480,
make_all: v1481,
}
}
}
}
impl From<CraftRecipeRequest> for ServerboundPlayPacket {
fn from(p: CraftRecipeRequest) -> Self {
Self::CraftRecipeRequest(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Abilities {
pub flags: i8,
}
impl crate::packet::Packet for Abilities {
const ID: i32 = id::ABILITIES;
const NAME: &'static str = "abilities";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for Abilities {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1482 = r.read_i8()?;
Abilities { flags: v1482 }
})
}
}
impl Encode for Abilities {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_i8((*self).flags);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for Abilities {
fn generate(g: &mut Gen) -> Self {
{
let v1483 = (g.int_in(-128, 127, &[]) as i8);
Abilities { flags: v1483 }
}
}
}
impl From<Abilities> for ServerboundPlayPacket {
fn from(p: Abilities) -> Self {
Self::Abilities(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct BlockDig {
pub status: i32,
pub location: BlockPos,
pub face: i8,
}
impl crate::packet::Packet for BlockDig {
const ID: i32 = id::BLOCK_DIG;
const NAME: &'static str = "block_dig";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for BlockDig {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1484 = r.read_varint()?;
let v1485 = BlockPos::read(r, PositionLayout::Xzy)?;
let v1486 = r.read_i8()?;
BlockDig {
status: v1484,
location: v1485,
face: v1486,
}
})
}
}
impl Encode for BlockDig {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).status);
(*self).location.write(w, PositionLayout::Xzy)?;
w.put_i8((*self).face);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for BlockDig {
fn generate(g: &mut Gen) -> Self {
{
let v1487 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1488 = g.position();
let v1489 = (g.int_in(-128, 127, &[]) as i8);
BlockDig {
status: v1487,
location: v1488,
face: v1489,
}
}
}
}
impl From<BlockDig> for ServerboundPlayPacket {
fn from(p: BlockDig) -> Self {
Self::BlockDig(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct EntityAction {
pub entity_id: i32,
pub action_id: EntityActionActionId,
pub jump_boost: i32,
}
impl crate::packet::Packet for EntityAction {
const ID: i32 = id::ENTITY_ACTION;
const NAME: &'static str = "entity_action";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for EntityAction {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1490 = r.read_varint()?;
let v1491 = EntityActionActionId(r.read_varint()?);
let v1492 = r.read_varint()?;
EntityAction {
entity_id: v1490,
action_id: v1491,
jump_boost: v1492,
}
})
}
}
impl Encode for EntityAction {
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(feature = "testgen")]
impl Generate for EntityAction {
fn generate(g: &mut Gen) -> Self {
{
let v1493 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1494 =
EntityActionActionId(
g.int_in(-2147483648, 2147483647, &[0, 1, 2, 3, 4, 5, 6, 7, 8]) as i32,
);
let v1495 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
EntityAction {
entity_id: v1493,
action_id: v1494,
jump_boost: v1495,
}
}
}
}
impl From<EntityAction> for ServerboundPlayPacket {
fn from(p: EntityAction) -> Self {
Self::EntityAction(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct SteerVehicle {
pub sideways: f32,
pub forward: f32,
pub jump: u8,
}
impl crate::packet::Packet for SteerVehicle {
const ID: i32 = id::STEER_VEHICLE;
const NAME: &'static str = "steer_vehicle";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for SteerVehicle {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1496 = r.read_f32()?;
let v1497 = r.read_f32()?;
let v1498 = r.read_u8()?;
SteerVehicle {
sideways: v1496,
forward: v1497,
jump: v1498,
}
})
}
}
impl Encode for SteerVehicle {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_f32((*self).sideways);
w.put_f32((*self).forward);
w.put_u8((*self).jump);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for SteerVehicle {
fn generate(g: &mut Gen) -> Self {
{
let v1499 = g.f32();
let v1500 = g.f32();
let v1501 = (g.int_in(0, 255, &[]) as u8);
SteerVehicle {
sideways: v1499,
forward: v1500,
jump: v1501,
}
}
}
}
impl From<SteerVehicle> for ServerboundPlayPacket {
fn from(p: SteerVehicle) -> Self {
Self::SteerVehicle(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct RecipeBook {
pub book_id: i32,
pub book_open: bool,
pub filter_active: bool,
}
impl crate::packet::Packet for RecipeBook {
const ID: i32 = id::RECIPE_BOOK;
const NAME: &'static str = "recipe_book";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for RecipeBook {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1502 = r.read_varint()?;
let v1503 = r.read_bool()?;
let v1504 = r.read_bool()?;
RecipeBook {
book_id: v1502,
book_open: v1503,
filter_active: v1504,
}
})
}
}
impl Encode for RecipeBook {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).book_id);
w.put_bool((*self).book_open);
w.put_bool((*self).filter_active);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for RecipeBook {
fn generate(g: &mut Gen) -> Self {
{
let v1505 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1506 = g.bool();
let v1507 = g.bool();
RecipeBook {
book_id: v1505,
book_open: v1506,
filter_active: v1507,
}
}
}
}
impl From<RecipeBook> for ServerboundPlayPacket {
fn from(p: RecipeBook) -> Self {
Self::RecipeBook(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct DisplayedRecipe {
pub recipe_id: ByteString,
}
impl crate::packet::Packet for DisplayedRecipe {
const ID: i32 = id::DISPLAYED_RECIPE;
const NAME: &'static str = "displayed_recipe";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for DisplayedRecipe {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1508 = r.read_string()?;
DisplayedRecipe { recipe_id: v1508 }
})
}
}
impl Encode for DisplayedRecipe {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_string(&(*self).recipe_id)?;
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for DisplayedRecipe {
fn generate(g: &mut Gen) -> Self {
{
let v1509 = g.string();
DisplayedRecipe { recipe_id: v1509 }
}
}
}
impl From<DisplayedRecipe> for ServerboundPlayPacket {
fn from(p: DisplayedRecipe) -> Self {
Self::DisplayedRecipe(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct NameItem {
pub name: ByteString,
}
impl crate::packet::Packet for NameItem {
const ID: i32 = id::NAME_ITEM;
const NAME: &'static str = "name_item";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for NameItem {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1510 = r.read_string()?;
NameItem { name: v1510 }
})
}
}
impl Encode for NameItem {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_string(&(*self).name)?;
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for NameItem {
fn generate(g: &mut Gen) -> Self {
{
let v1511 = g.string();
NameItem { name: v1511 }
}
}
}
impl From<NameItem> for ServerboundPlayPacket {
fn from(p: NameItem) -> Self {
Self::NameItem(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct ResourcePackReceive {
pub result: i32,
}
impl crate::packet::Packet for ResourcePackReceive {
const ID: i32 = id::RESOURCE_PACK_RECEIVE;
const NAME: &'static str = "resource_pack_receive";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for ResourcePackReceive {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1512 = r.read_varint()?;
ResourcePackReceive { result: v1512 }
})
}
}
impl Encode for ResourcePackReceive {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).result);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for ResourcePackReceive {
fn generate(g: &mut Gen) -> Self {
{
let v1513 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
ResourcePackReceive { result: v1513 }
}
}
}
impl From<ResourcePackReceive> for ServerboundPlayPacket {
fn from(p: ResourcePackReceive) -> Self {
Self::ResourcePackReceive(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct AdvancementTab {
pub action: i32,
pub tab_id: Option<ByteString>,
}
impl crate::packet::Packet for AdvancementTab {
const ID: i32 = id::ADVANCEMENT_TAB;
const NAME: &'static str = "advancement_tab";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for AdvancementTab {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1514 = r.read_varint()?;
let v1515 = if (v1514 == 0) {
Some(r.read_string()?)
} else {
None
};
AdvancementTab {
action: v1514,
tab_id: v1515,
}
})
}
}
impl Encode for AdvancementTab {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).action);
match (&(*self).tab_id, ((*self).action == 0)) {
(Some(v1516), true) => {
w.put_string(&(*v1516))?;
}
(None, false) => {}
_ => {
return Err(EncodeError::SwitchMismatch(
"play.serverbound.advancement_tab.tabId",
));
}
}
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for AdvancementTab {
fn generate(g: &mut Gen) -> Self {
{
let v1517 = (g.int_in(-2147483648, 2147483647, &[0, 1]) as i32);
let v1518 = if (v1517 == 0) { Some(g.string()) } else { None };
AdvancementTab {
action: v1517,
tab_id: v1518,
}
}
}
}
impl From<AdvancementTab> for ServerboundPlayPacket {
fn from(p: AdvancementTab) -> Self {
Self::AdvancementTab(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct SelectTrade {
pub slot: i32,
}
impl crate::packet::Packet for SelectTrade {
const ID: i32 = id::SELECT_TRADE;
const NAME: &'static str = "select_trade";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for SelectTrade {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1519 = r.read_varint()?;
SelectTrade { slot: v1519 }
})
}
}
impl Encode for SelectTrade {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).slot);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for SelectTrade {
fn generate(g: &mut Gen) -> Self {
{
let v1520 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
SelectTrade { slot: v1520 }
}
}
}
impl From<SelectTrade> for ServerboundPlayPacket {
fn from(p: SelectTrade) -> Self {
Self::SelectTrade(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct SetBeaconEffect {
pub primary_effect: i32,
pub secondary_effect: i32,
}
impl crate::packet::Packet for SetBeaconEffect {
const ID: i32 = id::SET_BEACON_EFFECT;
const NAME: &'static str = "set_beacon_effect";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for SetBeaconEffect {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1521 = r.read_varint()?;
let v1522 = r.read_varint()?;
SetBeaconEffect {
primary_effect: v1521,
secondary_effect: v1522,
}
})
}
}
impl Encode for SetBeaconEffect {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).primary_effect);
w.put_varint((*self).secondary_effect);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for SetBeaconEffect {
fn generate(g: &mut Gen) -> Self {
{
let v1523 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1524 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
SetBeaconEffect {
primary_effect: v1523,
secondary_effect: v1524,
}
}
}
}
impl From<SetBeaconEffect> for ServerboundPlayPacket {
fn from(p: SetBeaconEffect) -> Self {
Self::SetBeaconEffect(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct HeldItemSlot {
pub slot_id: i16,
}
impl crate::packet::Packet for HeldItemSlot {
const ID: i32 = id::HELD_ITEM_SLOT;
const NAME: &'static str = "held_item_slot";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for HeldItemSlot {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1525 = r.read_i16()?;
HeldItemSlot { slot_id: v1525 }
})
}
}
impl Encode for HeldItemSlot {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_i16((*self).slot_id);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for HeldItemSlot {
fn generate(g: &mut Gen) -> Self {
{
let v1526 = (g.int_in(-32768, 32767, &[]) as i16);
HeldItemSlot { slot_id: v1526 }
}
}
}
impl From<HeldItemSlot> for ServerboundPlayPacket {
fn from(p: HeldItemSlot) -> Self {
Self::HeldItemSlot(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct UpdateCommandBlock {
pub location: BlockPos,
pub command: ByteString,
pub mode: i32,
pub flags: u8,
}
impl crate::packet::Packet for UpdateCommandBlock {
const ID: i32 = id::UPDATE_COMMAND_BLOCK;
const NAME: &'static str = "update_command_block";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for UpdateCommandBlock {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1527 = BlockPos::read(r, PositionLayout::Xzy)?;
let v1528 = r.read_string()?;
let v1529 = r.read_varint()?;
let v1530 = r.read_u8()?;
UpdateCommandBlock {
location: v1527,
command: v1528,
mode: v1529,
flags: v1530,
}
})
}
}
impl Encode for UpdateCommandBlock {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
(*self).location.write(w, PositionLayout::Xzy)?;
w.put_string(&(*self).command)?;
w.put_varint((*self).mode);
w.put_u8((*self).flags);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for UpdateCommandBlock {
fn generate(g: &mut Gen) -> Self {
{
let v1531 = g.position();
let v1532 = g.string();
let v1533 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1534 = (g.int_in(0, 255, &[]) as u8);
UpdateCommandBlock {
location: v1531,
command: v1532,
mode: v1533,
flags: v1534,
}
}
}
}
impl From<UpdateCommandBlock> for ServerboundPlayPacket {
fn from(p: UpdateCommandBlock) -> Self {
Self::UpdateCommandBlock(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct UpdateCommandBlockMinecart {
pub entity_id: i32,
pub command: ByteString,
pub track_output: bool,
}
impl crate::packet::Packet for UpdateCommandBlockMinecart {
const ID: i32 = id::UPDATE_COMMAND_BLOCK_MINECART;
const NAME: &'static str = "update_command_block_minecart";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for UpdateCommandBlockMinecart {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1535 = r.read_varint()?;
let v1536 = r.read_string()?;
let v1537 = r.read_bool()?;
UpdateCommandBlockMinecart {
entity_id: v1535,
command: v1536,
track_output: v1537,
}
})
}
}
impl Encode for UpdateCommandBlockMinecart {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).entity_id);
w.put_string(&(*self).command)?;
w.put_bool((*self).track_output);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for UpdateCommandBlockMinecart {
fn generate(g: &mut Gen) -> Self {
{
let v1538 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1539 = g.string();
let v1540 = g.bool();
UpdateCommandBlockMinecart {
entity_id: v1538,
command: v1539,
track_output: v1540,
}
}
}
}
impl From<UpdateCommandBlockMinecart> for ServerboundPlayPacket {
fn from(p: UpdateCommandBlockMinecart) -> Self {
Self::UpdateCommandBlockMinecart(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct SetCreativeSlot {
pub slot: i16,
pub item: types::Slot,
}
impl crate::packet::Packet for SetCreativeSlot {
const ID: i32 = id::SET_CREATIVE_SLOT;
const NAME: &'static str = "set_creative_slot";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for SetCreativeSlot {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1541 = r.read_i16()?;
let v1542 = <types::Slot as Decode>::decode(r)?;
SetCreativeSlot {
slot: v1541,
item: v1542,
}
})
}
}
impl Encode for SetCreativeSlot {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_i16((*self).slot);
(*self).item.encode(w)?;
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for SetCreativeSlot {
fn generate(g: &mut Gen) -> Self {
{
let v1543 = (g.int_in(-32768, 32767, &[]) as i16);
let v1544 = <types::Slot as Generate>::generate(g);
SetCreativeSlot {
slot: v1543,
item: v1544,
}
}
}
}
impl From<SetCreativeSlot> for ServerboundPlayPacket {
fn from(p: SetCreativeSlot) -> Self {
Self::SetCreativeSlot(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct UpdateJigsawBlock {
pub location: BlockPos,
pub name: ByteString,
pub target: ByteString,
pub pool: ByteString,
pub final_state: ByteString,
pub joint_type: ByteString,
}
impl crate::packet::Packet for UpdateJigsawBlock {
const ID: i32 = id::UPDATE_JIGSAW_BLOCK;
const NAME: &'static str = "update_jigsaw_block";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for UpdateJigsawBlock {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1545 = BlockPos::read(r, PositionLayout::Xzy)?;
let v1546 = r.read_string()?;
let v1547 = r.read_string()?;
let v1548 = r.read_string()?;
let v1549 = r.read_string()?;
let v1550 = r.read_string()?;
UpdateJigsawBlock {
location: v1545,
name: v1546,
target: v1547,
pool: v1548,
final_state: v1549,
joint_type: v1550,
}
})
}
}
impl Encode for UpdateJigsawBlock {
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)?;
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for UpdateJigsawBlock {
fn generate(g: &mut Gen) -> Self {
{
let v1551 = g.position();
let v1552 = g.string();
let v1553 = g.string();
let v1554 = g.string();
let v1555 = g.string();
let v1556 = g.string();
UpdateJigsawBlock {
location: v1551,
name: v1552,
target: v1553,
pool: v1554,
final_state: v1555,
joint_type: v1556,
}
}
}
}
impl From<UpdateJigsawBlock> for ServerboundPlayPacket {
fn from(p: UpdateJigsawBlock) -> Self {
Self::UpdateJigsawBlock(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct UpdateStructureBlock {
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: i64,
pub flags: u8,
}
impl crate::packet::Packet for UpdateStructureBlock {
const ID: i32 = id::UPDATE_STRUCTURE_BLOCK;
const NAME: &'static str = "update_structure_block";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for UpdateStructureBlock {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1557 = BlockPos::read(r, PositionLayout::Xzy)?;
let v1558 = r.read_varint()?;
let v1559 = r.read_varint()?;
let v1560 = r.read_string()?;
let v1561 = r.read_i8()?;
let v1562 = r.read_i8()?;
let v1563 = r.read_i8()?;
let v1564 = r.read_i8()?;
let v1565 = r.read_i8()?;
let v1566 = r.read_i8()?;
let v1567 = r.read_varint()?;
let v1568 = r.read_varint()?;
let v1569 = r.read_string()?;
let v1570 = r.read_f32()?;
let v1571 = r.read_varlong()?;
let v1572 = r.read_u8()?;
UpdateStructureBlock {
location: v1557,
action: v1558,
mode: v1559,
name: v1560,
offset_x: v1561,
offset_y: v1562,
offset_z: v1563,
size_x: v1564,
size_y: v1565,
size_z: v1566,
mirror: v1567,
rotation: v1568,
metadata: v1569,
integrity: v1570,
seed: v1571,
flags: v1572,
}
})
}
}
impl Encode for UpdateStructureBlock {
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_varlong((*self).seed);
w.put_u8((*self).flags);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for UpdateStructureBlock {
fn generate(g: &mut Gen) -> Self {
{
let v1573 = g.position();
let v1574 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1575 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1576 = g.string();
let v1577 = (g.int_in(-128, 127, &[]) as i8);
let v1578 = (g.int_in(-128, 127, &[]) as i8);
let v1579 = (g.int_in(-128, 127, &[]) as i8);
let v1580 = (g.int_in(-128, 127, &[]) as i8);
let v1581 = (g.int_in(-128, 127, &[]) as i8);
let v1582 = (g.int_in(-128, 127, &[]) as i8);
let v1583 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1584 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1585 = g.string();
let v1586 = g.f32();
let v1587 = g.varlong();
let v1588 = (g.int_in(0, 255, &[]) as u8);
UpdateStructureBlock {
location: v1573,
action: v1574,
mode: v1575,
name: v1576,
offset_x: v1577,
offset_y: v1578,
offset_z: v1579,
size_x: v1580,
size_y: v1581,
size_z: v1582,
mirror: v1583,
rotation: v1584,
metadata: v1585,
integrity: v1586,
seed: v1587,
flags: v1588,
}
}
}
}
impl From<UpdateStructureBlock> for ServerboundPlayPacket {
fn from(p: UpdateStructureBlock) -> Self {
Self::UpdateStructureBlock(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct UpdateSign {
pub location: BlockPos,
pub text1: ByteString,
pub text2: ByteString,
pub text3: ByteString,
pub text4: ByteString,
}
impl crate::packet::Packet for UpdateSign {
const ID: i32 = id::UPDATE_SIGN;
const NAME: &'static str = "update_sign";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for UpdateSign {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1589 = BlockPos::read(r, PositionLayout::Xzy)?;
let v1590 = r.read_string()?;
let v1591 = r.read_string()?;
let v1592 = r.read_string()?;
let v1593 = r.read_string()?;
UpdateSign {
location: v1589,
text1: v1590,
text2: v1591,
text3: v1592,
text4: v1593,
}
})
}
}
impl Encode for UpdateSign {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
(*self).location.write(w, PositionLayout::Xzy)?;
w.put_string(&(*self).text1)?;
w.put_string(&(*self).text2)?;
w.put_string(&(*self).text3)?;
w.put_string(&(*self).text4)?;
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for UpdateSign {
fn generate(g: &mut Gen) -> Self {
{
let v1594 = g.position();
let v1595 = g.string();
let v1596 = g.string();
let v1597 = g.string();
let v1598 = g.string();
UpdateSign {
location: v1594,
text1: v1595,
text2: v1596,
text3: v1597,
text4: v1598,
}
}
}
}
impl From<UpdateSign> for ServerboundPlayPacket {
fn from(p: UpdateSign) -> Self {
Self::UpdateSign(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct ArmAnimation {
pub hand: i32,
}
impl crate::packet::Packet for ArmAnimation {
const ID: i32 = id::ARM_ANIMATION;
const NAME: &'static str = "arm_animation";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for ArmAnimation {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1599 = r.read_varint()?;
ArmAnimation { hand: v1599 }
})
}
}
impl Encode for ArmAnimation {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).hand);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for ArmAnimation {
fn generate(g: &mut Gen) -> Self {
{
let v1600 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
ArmAnimation { hand: v1600 }
}
}
}
impl From<ArmAnimation> for ServerboundPlayPacket {
fn from(p: ArmAnimation) -> Self {
Self::ArmAnimation(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Spectate {
pub target: Uuid,
}
impl crate::packet::Packet for Spectate {
const ID: i32 = id::SPECTATE;
const NAME: &'static str = "spectate";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for Spectate {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1601 = r.read_uuid()?;
Spectate { target: v1601 }
})
}
}
impl Encode for Spectate {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_uuid(&(*self).target);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for Spectate {
fn generate(g: &mut Gen) -> Self {
{
let v1602 = g.uuid();
Spectate { target: v1602 }
}
}
}
impl From<Spectate> for ServerboundPlayPacket {
fn from(p: Spectate) -> Self {
Self::Spectate(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct BlockPlace {
pub hand: i32,
pub location: BlockPos,
pub direction: i32,
pub cursor_x: f32,
pub cursor_y: f32,
pub cursor_z: f32,
pub inside_block: bool,
}
impl crate::packet::Packet for BlockPlace {
const ID: i32 = id::BLOCK_PLACE;
const NAME: &'static str = "block_place";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for BlockPlace {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1603 = r.read_varint()?;
let v1604 = BlockPos::read(r, PositionLayout::Xzy)?;
let v1605 = r.read_varint()?;
let v1606 = r.read_f32()?;
let v1607 = r.read_f32()?;
let v1608 = r.read_f32()?;
let v1609 = r.read_bool()?;
BlockPlace {
hand: v1603,
location: v1604,
direction: v1605,
cursor_x: v1606,
cursor_y: v1607,
cursor_z: v1608,
inside_block: v1609,
}
})
}
}
impl Encode for BlockPlace {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).hand);
(*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);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for BlockPlace {
fn generate(g: &mut Gen) -> Self {
{
let v1610 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1611 = g.position();
let v1612 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
let v1613 = g.f32();
let v1614 = g.f32();
let v1615 = g.f32();
let v1616 = g.bool();
BlockPlace {
hand: v1610,
location: v1611,
direction: v1612,
cursor_x: v1613,
cursor_y: v1614,
cursor_z: v1615,
inside_block: v1616,
}
}
}
}
impl From<BlockPlace> for ServerboundPlayPacket {
fn from(p: BlockPlace) -> Self {
Self::BlockPlace(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct UseItem {
pub hand: i32,
}
impl crate::packet::Packet for UseItem {
const ID: i32 = id::USE_ITEM;
const NAME: &'static str = "use_item";
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
}
impl Decode for UseItem {
fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
Ok({
let v1617 = r.read_varint()?;
UseItem { hand: v1617 }
})
}
}
impl Encode for UseItem {
fn encode(&self, w: &mut BytesMut) -> EncodeResult {
w.put_varint((*self).hand);
Ok(())
}
}
#[cfg(feature = "testgen")]
impl Generate for UseItem {
fn generate(g: &mut Gen) -> Self {
{
let v1618 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
UseItem { hand: v1618 }
}
}
}
impl From<UseItem> for ServerboundPlayPacket {
fn from(p: UseItem) -> Self {
Self::UseItem(p)
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum ServerboundPlayPacket {
TeleportConfirm(TeleportConfirm),
QueryBlockNbt(QueryBlockNbt),
SetDifficulty(SetDifficulty),
Chat(Chat),
ClientCommand(ClientCommand),
Settings(Settings),
TabComplete(TabComplete),
Transaction(Transaction),
EnchantItem(EnchantItem),
WindowClick(WindowClick),
CloseWindow(CloseWindow),
CustomPayload(CustomPayload),
EditBook(EditBook),
QueryEntityNbt(QueryEntityNbt),
UseEntity(UseEntity),
GenerateStructure(GenerateStructure),
KeepAlive(KeepAlive),
LockDifficulty(LockDifficulty),
Position(Position),
PositionLook(PositionLook),
Look(Look),
Flying(Flying),
VehicleMove(VehicleMove),
SteerBoat(SteerBoat),
PickItem(PickItem),
CraftRecipeRequest(CraftRecipeRequest),
Abilities(Abilities),
BlockDig(BlockDig),
EntityAction(EntityAction),
SteerVehicle(SteerVehicle),
RecipeBook(RecipeBook),
DisplayedRecipe(DisplayedRecipe),
NameItem(NameItem),
ResourcePackReceive(ResourcePackReceive),
AdvancementTab(AdvancementTab),
SelectTrade(SelectTrade),
SetBeaconEffect(SetBeaconEffect),
HeldItemSlot(HeldItemSlot),
UpdateCommandBlock(UpdateCommandBlock),
UpdateCommandBlockMinecart(UpdateCommandBlockMinecart),
SetCreativeSlot(SetCreativeSlot),
UpdateJigsawBlock(UpdateJigsawBlock),
UpdateStructureBlock(UpdateStructureBlock),
UpdateSign(UpdateSign),
ArmAnimation(ArmAnimation),
Spectate(Spectate),
BlockPlace(BlockPlace),
UseItem(UseItem),
}
impl PacketSet for ServerboundPlayPacket {
const STATE: State = State::Play;
const DIRECTION: Direction = Direction::Serverbound;
fn decode_raw(raw: &RawPacket) -> DecodeResult<Self> {
match raw.id {
id::TELEPORT_CONFIRM => decode_exact(&raw.body).map(Self::TeleportConfirm),
id::QUERY_BLOCK_NBT => decode_exact(&raw.body).map(Self::QueryBlockNbt),
id::SET_DIFFICULTY => decode_exact(&raw.body).map(Self::SetDifficulty),
id::CHAT => decode_exact(&raw.body).map(Self::Chat),
id::CLIENT_COMMAND => decode_exact(&raw.body).map(Self::ClientCommand),
id::SETTINGS => decode_exact(&raw.body).map(Self::Settings),
id::TAB_COMPLETE => decode_exact(&raw.body).map(Self::TabComplete),
id::TRANSACTION => decode_exact(&raw.body).map(Self::Transaction),
id::ENCHANT_ITEM => decode_exact(&raw.body).map(Self::EnchantItem),
id::WINDOW_CLICK => decode_exact(&raw.body).map(Self::WindowClick),
id::CLOSE_WINDOW => decode_exact(&raw.body).map(Self::CloseWindow),
id::CUSTOM_PAYLOAD => decode_exact(&raw.body).map(Self::CustomPayload),
id::EDIT_BOOK => decode_exact(&raw.body).map(Self::EditBook),
id::QUERY_ENTITY_NBT => decode_exact(&raw.body).map(Self::QueryEntityNbt),
id::USE_ENTITY => decode_exact(&raw.body).map(Self::UseEntity),
id::GENERATE_STRUCTURE => decode_exact(&raw.body).map(Self::GenerateStructure),
id::KEEP_ALIVE => decode_exact(&raw.body).map(Self::KeepAlive),
id::LOCK_DIFFICULTY => decode_exact(&raw.body).map(Self::LockDifficulty),
id::POSITION => decode_exact(&raw.body).map(Self::Position),
id::POSITION_LOOK => decode_exact(&raw.body).map(Self::PositionLook),
id::LOOK => decode_exact(&raw.body).map(Self::Look),
id::FLYING => decode_exact(&raw.body).map(Self::Flying),
id::VEHICLE_MOVE => decode_exact(&raw.body).map(Self::VehicleMove),
id::STEER_BOAT => decode_exact(&raw.body).map(Self::SteerBoat),
id::PICK_ITEM => decode_exact(&raw.body).map(Self::PickItem),
id::CRAFT_RECIPE_REQUEST => decode_exact(&raw.body).map(Self::CraftRecipeRequest),
id::ABILITIES => decode_exact(&raw.body).map(Self::Abilities),
id::BLOCK_DIG => decode_exact(&raw.body).map(Self::BlockDig),
id::ENTITY_ACTION => decode_exact(&raw.body).map(Self::EntityAction),
id::STEER_VEHICLE => decode_exact(&raw.body).map(Self::SteerVehicle),
id::RECIPE_BOOK => decode_exact(&raw.body).map(Self::RecipeBook),
id::DISPLAYED_RECIPE => decode_exact(&raw.body).map(Self::DisplayedRecipe),
id::NAME_ITEM => decode_exact(&raw.body).map(Self::NameItem),
id::RESOURCE_PACK_RECEIVE => decode_exact(&raw.body).map(Self::ResourcePackReceive),
id::ADVANCEMENT_TAB => decode_exact(&raw.body).map(Self::AdvancementTab),
id::SELECT_TRADE => decode_exact(&raw.body).map(Self::SelectTrade),
id::SET_BEACON_EFFECT => decode_exact(&raw.body).map(Self::SetBeaconEffect),
id::HELD_ITEM_SLOT => decode_exact(&raw.body).map(Self::HeldItemSlot),
id::UPDATE_COMMAND_BLOCK => decode_exact(&raw.body).map(Self::UpdateCommandBlock),
id::UPDATE_COMMAND_BLOCK_MINECART => {
decode_exact(&raw.body).map(Self::UpdateCommandBlockMinecart)
}
id::SET_CREATIVE_SLOT => decode_exact(&raw.body).map(Self::SetCreativeSlot),
id::UPDATE_JIGSAW_BLOCK => decode_exact(&raw.body).map(Self::UpdateJigsawBlock),
id::UPDATE_STRUCTURE_BLOCK => decode_exact(&raw.body).map(Self::UpdateStructureBlock),
id::UPDATE_SIGN => decode_exact(&raw.body).map(Self::UpdateSign),
id::ARM_ANIMATION => decode_exact(&raw.body).map(Self::ArmAnimation),
id::SPECTATE => decode_exact(&raw.body).map(Self::Spectate),
id::BLOCK_PLACE => decode_exact(&raw.body).map(Self::BlockPlace),
id::USE_ITEM => decode_exact(&raw.body).map(Self::UseItem),
other => Err(DecodeError::UnknownPacketId(other)),
}
}
fn id(&self) -> i32 {
match *self {
Self::TeleportConfirm(_) => id::TELEPORT_CONFIRM,
Self::QueryBlockNbt(_) => id::QUERY_BLOCK_NBT,
Self::SetDifficulty(_) => id::SET_DIFFICULTY,
Self::Chat(_) => id::CHAT,
Self::ClientCommand(_) => id::CLIENT_COMMAND,
Self::Settings(_) => id::SETTINGS,
Self::TabComplete(_) => id::TAB_COMPLETE,
Self::Transaction(_) => id::TRANSACTION,
Self::EnchantItem(_) => id::ENCHANT_ITEM,
Self::WindowClick(_) => id::WINDOW_CLICK,
Self::CloseWindow(_) => id::CLOSE_WINDOW,
Self::CustomPayload(_) => id::CUSTOM_PAYLOAD,
Self::EditBook(_) => id::EDIT_BOOK,
Self::QueryEntityNbt(_) => id::QUERY_ENTITY_NBT,
Self::UseEntity(_) => id::USE_ENTITY,
Self::GenerateStructure(_) => id::GENERATE_STRUCTURE,
Self::KeepAlive(_) => id::KEEP_ALIVE,
Self::LockDifficulty(_) => id::LOCK_DIFFICULTY,
Self::Position(_) => id::POSITION,
Self::PositionLook(_) => id::POSITION_LOOK,
Self::Look(_) => id::LOOK,
Self::Flying(_) => id::FLYING,
Self::VehicleMove(_) => id::VEHICLE_MOVE,
Self::SteerBoat(_) => id::STEER_BOAT,
Self::PickItem(_) => id::PICK_ITEM,
Self::CraftRecipeRequest(_) => id::CRAFT_RECIPE_REQUEST,
Self::Abilities(_) => id::ABILITIES,
Self::BlockDig(_) => id::BLOCK_DIG,
Self::EntityAction(_) => id::ENTITY_ACTION,
Self::SteerVehicle(_) => id::STEER_VEHICLE,
Self::RecipeBook(_) => id::RECIPE_BOOK,
Self::DisplayedRecipe(_) => id::DISPLAYED_RECIPE,
Self::NameItem(_) => id::NAME_ITEM,
Self::ResourcePackReceive(_) => id::RESOURCE_PACK_RECEIVE,
Self::AdvancementTab(_) => id::ADVANCEMENT_TAB,
Self::SelectTrade(_) => id::SELECT_TRADE,
Self::SetBeaconEffect(_) => id::SET_BEACON_EFFECT,
Self::HeldItemSlot(_) => id::HELD_ITEM_SLOT,
Self::UpdateCommandBlock(_) => id::UPDATE_COMMAND_BLOCK,
Self::UpdateCommandBlockMinecart(_) => id::UPDATE_COMMAND_BLOCK_MINECART,
Self::SetCreativeSlot(_) => id::SET_CREATIVE_SLOT,
Self::UpdateJigsawBlock(_) => id::UPDATE_JIGSAW_BLOCK,
Self::UpdateStructureBlock(_) => id::UPDATE_STRUCTURE_BLOCK,
Self::UpdateSign(_) => id::UPDATE_SIGN,
Self::ArmAnimation(_) => id::ARM_ANIMATION,
Self::Spectate(_) => id::SPECTATE,
Self::BlockPlace(_) => id::BLOCK_PLACE,
Self::UseItem(_) => id::USE_ITEM,
}
}
fn name(&self) -> &'static str {
match *self {
Self::TeleportConfirm(_) => "teleport_confirm",
Self::QueryBlockNbt(_) => "query_block_nbt",
Self::SetDifficulty(_) => "set_difficulty",
Self::Chat(_) => "chat",
Self::ClientCommand(_) => "client_command",
Self::Settings(_) => "settings",
Self::TabComplete(_) => "tab_complete",
Self::Transaction(_) => "transaction",
Self::EnchantItem(_) => "enchant_item",
Self::WindowClick(_) => "window_click",
Self::CloseWindow(_) => "close_window",
Self::CustomPayload(_) => "custom_payload",
Self::EditBook(_) => "edit_book",
Self::QueryEntityNbt(_) => "query_entity_nbt",
Self::UseEntity(_) => "use_entity",
Self::GenerateStructure(_) => "generate_structure",
Self::KeepAlive(_) => "keep_alive",
Self::LockDifficulty(_) => "lock_difficulty",
Self::Position(_) => "position",
Self::PositionLook(_) => "position_look",
Self::Look(_) => "look",
Self::Flying(_) => "flying",
Self::VehicleMove(_) => "vehicle_move",
Self::SteerBoat(_) => "steer_boat",
Self::PickItem(_) => "pick_item",
Self::CraftRecipeRequest(_) => "craft_recipe_request",
Self::Abilities(_) => "abilities",
Self::BlockDig(_) => "block_dig",
Self::EntityAction(_) => "entity_action",
Self::SteerVehicle(_) => "steer_vehicle",
Self::RecipeBook(_) => "recipe_book",
Self::DisplayedRecipe(_) => "displayed_recipe",
Self::NameItem(_) => "name_item",
Self::ResourcePackReceive(_) => "resource_pack_receive",
Self::AdvancementTab(_) => "advancement_tab",
Self::SelectTrade(_) => "select_trade",
Self::SetBeaconEffect(_) => "set_beacon_effect",
Self::HeldItemSlot(_) => "held_item_slot",
Self::UpdateCommandBlock(_) => "update_command_block",
Self::UpdateCommandBlockMinecart(_) => "update_command_block_minecart",
Self::SetCreativeSlot(_) => "set_creative_slot",
Self::UpdateJigsawBlock(_) => "update_jigsaw_block",
Self::UpdateStructureBlock(_) => "update_structure_block",
Self::UpdateSign(_) => "update_sign",
Self::ArmAnimation(_) => "arm_animation",
Self::Spectate(_) => "spectate",
Self::BlockPlace(_) => "block_place",
Self::UseItem(_) => "use_item",
}
}
fn encode_body(&self, w: &mut BytesMut) -> EncodeResult {
match *self {
Self::TeleportConfirm(ref p) => p.encode(w),
Self::QueryBlockNbt(ref p) => p.encode(w),
Self::SetDifficulty(ref p) => p.encode(w),
Self::Chat(ref p) => p.encode(w),
Self::ClientCommand(ref p) => p.encode(w),
Self::Settings(ref p) => p.encode(w),
Self::TabComplete(ref p) => p.encode(w),
Self::Transaction(ref p) => p.encode(w),
Self::EnchantItem(ref p) => p.encode(w),
Self::WindowClick(ref p) => p.encode(w),
Self::CloseWindow(ref p) => p.encode(w),
Self::CustomPayload(ref p) => p.encode(w),
Self::EditBook(ref p) => p.encode(w),
Self::QueryEntityNbt(ref p) => p.encode(w),
Self::UseEntity(ref p) => p.encode(w),
Self::GenerateStructure(ref p) => p.encode(w),
Self::KeepAlive(ref p) => p.encode(w),
Self::LockDifficulty(ref p) => p.encode(w),
Self::Position(ref p) => p.encode(w),
Self::PositionLook(ref p) => p.encode(w),
Self::Look(ref p) => p.encode(w),
Self::Flying(ref p) => p.encode(w),
Self::VehicleMove(ref p) => p.encode(w),
Self::SteerBoat(ref p) => p.encode(w),
Self::PickItem(ref p) => p.encode(w),
Self::CraftRecipeRequest(ref p) => p.encode(w),
Self::Abilities(ref p) => p.encode(w),
Self::BlockDig(ref p) => p.encode(w),
Self::EntityAction(ref p) => p.encode(w),
Self::SteerVehicle(ref p) => p.encode(w),
Self::RecipeBook(ref p) => p.encode(w),
Self::DisplayedRecipe(ref p) => p.encode(w),
Self::NameItem(ref p) => p.encode(w),
Self::ResourcePackReceive(ref p) => p.encode(w),
Self::AdvancementTab(ref p) => p.encode(w),
Self::SelectTrade(ref p) => p.encode(w),
Self::SetBeaconEffect(ref p) => p.encode(w),
Self::HeldItemSlot(ref p) => p.encode(w),
Self::UpdateCommandBlock(ref p) => p.encode(w),
Self::UpdateCommandBlockMinecart(ref p) => p.encode(w),
Self::SetCreativeSlot(ref p) => p.encode(w),
Self::UpdateJigsawBlock(ref p) => p.encode(w),
Self::UpdateStructureBlock(ref p) => p.encode(w),
Self::UpdateSign(ref p) => p.encode(w),
Self::ArmAnimation(ref p) => p.encode(w),
Self::Spectate(ref p) => p.encode(w),
Self::BlockPlace(ref p) => p.encode(w),
Self::UseItem(ref p) => p.encode(w),
}
}
fn name_of(id: i32) -> Option<&'static str> {
match id {
id::TELEPORT_CONFIRM => Some("teleport_confirm"),
id::QUERY_BLOCK_NBT => Some("query_block_nbt"),
id::SET_DIFFICULTY => Some("set_difficulty"),
id::CHAT => Some("chat"),
id::CLIENT_COMMAND => Some("client_command"),
id::SETTINGS => Some("settings"),
id::TAB_COMPLETE => Some("tab_complete"),
id::TRANSACTION => Some("transaction"),
id::ENCHANT_ITEM => Some("enchant_item"),
id::WINDOW_CLICK => Some("window_click"),
id::CLOSE_WINDOW => Some("close_window"),
id::CUSTOM_PAYLOAD => Some("custom_payload"),
id::EDIT_BOOK => Some("edit_book"),
id::QUERY_ENTITY_NBT => Some("query_entity_nbt"),
id::USE_ENTITY => Some("use_entity"),
id::GENERATE_STRUCTURE => Some("generate_structure"),
id::KEEP_ALIVE => Some("keep_alive"),
id::LOCK_DIFFICULTY => Some("lock_difficulty"),
id::POSITION => Some("position"),
id::POSITION_LOOK => Some("position_look"),
id::LOOK => Some("look"),
id::FLYING => Some("flying"),
id::VEHICLE_MOVE => Some("vehicle_move"),
id::STEER_BOAT => Some("steer_boat"),
id::PICK_ITEM => Some("pick_item"),
id::CRAFT_RECIPE_REQUEST => Some("craft_recipe_request"),
id::ABILITIES => Some("abilities"),
id::BLOCK_DIG => Some("block_dig"),
id::ENTITY_ACTION => Some("entity_action"),
id::STEER_VEHICLE => Some("steer_vehicle"),
id::RECIPE_BOOK => Some("recipe_book"),
id::DISPLAYED_RECIPE => Some("displayed_recipe"),
id::NAME_ITEM => Some("name_item"),
id::RESOURCE_PACK_RECEIVE => Some("resource_pack_receive"),
id::ADVANCEMENT_TAB => Some("advancement_tab"),
id::SELECT_TRADE => Some("select_trade"),
id::SET_BEACON_EFFECT => Some("set_beacon_effect"),
id::HELD_ITEM_SLOT => Some("held_item_slot"),
id::UPDATE_COMMAND_BLOCK => Some("update_command_block"),
id::UPDATE_COMMAND_BLOCK_MINECART => Some("update_command_block_minecart"),
id::SET_CREATIVE_SLOT => Some("set_creative_slot"),
id::UPDATE_JIGSAW_BLOCK => Some("update_jigsaw_block"),
id::UPDATE_STRUCTURE_BLOCK => Some("update_structure_block"),
id::UPDATE_SIGN => Some("update_sign"),
id::ARM_ANIMATION => Some("arm_animation"),
id::SPECTATE => Some("spectate"),
id::BLOCK_PLACE => Some("block_place"),
id::USE_ITEM => Some("use_item"),
_ => None,
}
}
}
impl ServerboundPlayPacket {
pub const IDS: &'static [i32] = &[
id::TELEPORT_CONFIRM,
id::QUERY_BLOCK_NBT,
id::SET_DIFFICULTY,
id::CHAT,
id::CLIENT_COMMAND,
id::SETTINGS,
id::TAB_COMPLETE,
id::TRANSACTION,
id::ENCHANT_ITEM,
id::WINDOW_CLICK,
id::CLOSE_WINDOW,
id::CUSTOM_PAYLOAD,
id::EDIT_BOOK,
id::QUERY_ENTITY_NBT,
id::USE_ENTITY,
id::GENERATE_STRUCTURE,
id::KEEP_ALIVE,
id::LOCK_DIFFICULTY,
id::POSITION,
id::POSITION_LOOK,
id::LOOK,
id::FLYING,
id::VEHICLE_MOVE,
id::STEER_BOAT,
id::PICK_ITEM,
id::CRAFT_RECIPE_REQUEST,
id::ABILITIES,
id::BLOCK_DIG,
id::ENTITY_ACTION,
id::STEER_VEHICLE,
id::RECIPE_BOOK,
id::DISPLAYED_RECIPE,
id::NAME_ITEM,
id::RESOURCE_PACK_RECEIVE,
id::ADVANCEMENT_TAB,
id::SELECT_TRADE,
id::SET_BEACON_EFFECT,
id::HELD_ITEM_SLOT,
id::UPDATE_COMMAND_BLOCK,
id::UPDATE_COMMAND_BLOCK_MINECART,
id::SET_CREATIVE_SLOT,
id::UPDATE_JIGSAW_BLOCK,
id::UPDATE_STRUCTURE_BLOCK,
id::UPDATE_SIGN,
id::ARM_ANIMATION,
id::SPECTATE,
id::BLOCK_PLACE,
id::USE_ITEM,
];
#[cfg(feature = "testgen")]
pub fn generate_by_id(id: i32, g: &mut Gen) -> Option<Self> {
match id {
id::TELEPORT_CONFIRM => Some(Self::TeleportConfirm(
<TeleportConfirm as Generate>::generate(g),
)),
id::QUERY_BLOCK_NBT => Some(Self::QueryBlockNbt(
<QueryBlockNbt as Generate>::generate(g),
)),
id::SET_DIFFICULTY => Some(Self::SetDifficulty(<SetDifficulty as Generate>::generate(
g,
))),
id::CHAT => Some(Self::Chat(<Chat as Generate>::generate(g))),
id::CLIENT_COMMAND => Some(Self::ClientCommand(<ClientCommand as Generate>::generate(
g,
))),
id::SETTINGS => Some(Self::Settings(<Settings as Generate>::generate(g))),
id::TAB_COMPLETE => Some(Self::TabComplete(<TabComplete as Generate>::generate(g))),
id::TRANSACTION => Some(Self::Transaction(<Transaction as Generate>::generate(g))),
id::ENCHANT_ITEM => Some(Self::EnchantItem(<EnchantItem as Generate>::generate(g))),
id::WINDOW_CLICK => Some(Self::WindowClick(<WindowClick as Generate>::generate(g))),
id::CLOSE_WINDOW => Some(Self::CloseWindow(<CloseWindow as Generate>::generate(g))),
id::CUSTOM_PAYLOAD => Some(Self::CustomPayload(<CustomPayload as Generate>::generate(
g,
))),
id::EDIT_BOOK => Some(Self::EditBook(<EditBook as Generate>::generate(g))),
id::QUERY_ENTITY_NBT => Some(Self::QueryEntityNbt(
<QueryEntityNbt as Generate>::generate(g),
)),
id::USE_ENTITY => Some(Self::UseEntity(<UseEntity as Generate>::generate(g))),
id::GENERATE_STRUCTURE => Some(Self::GenerateStructure(
<GenerateStructure as Generate>::generate(g),
)),
id::KEEP_ALIVE => Some(Self::KeepAlive(<KeepAlive as Generate>::generate(g))),
id::LOCK_DIFFICULTY => Some(Self::LockDifficulty(
<LockDifficulty as Generate>::generate(g),
)),
id::POSITION => Some(Self::Position(<Position as Generate>::generate(g))),
id::POSITION_LOOK => Some(Self::PositionLook(<PositionLook as Generate>::generate(g))),
id::LOOK => Some(Self::Look(<Look as Generate>::generate(g))),
id::FLYING => Some(Self::Flying(<Flying as Generate>::generate(g))),
id::VEHICLE_MOVE => Some(Self::VehicleMove(<VehicleMove as Generate>::generate(g))),
id::STEER_BOAT => Some(Self::SteerBoat(<SteerBoat as Generate>::generate(g))),
id::PICK_ITEM => Some(Self::PickItem(<PickItem as Generate>::generate(g))),
id::CRAFT_RECIPE_REQUEST => Some(Self::CraftRecipeRequest(
<CraftRecipeRequest as Generate>::generate(g),
)),
id::ABILITIES => Some(Self::Abilities(<Abilities as Generate>::generate(g))),
id::BLOCK_DIG => Some(Self::BlockDig(<BlockDig as Generate>::generate(g))),
id::ENTITY_ACTION => Some(Self::EntityAction(<EntityAction as Generate>::generate(g))),
id::STEER_VEHICLE => Some(Self::SteerVehicle(<SteerVehicle as Generate>::generate(g))),
id::RECIPE_BOOK => Some(Self::RecipeBook(<RecipeBook as Generate>::generate(g))),
id::DISPLAYED_RECIPE => Some(Self::DisplayedRecipe(
<DisplayedRecipe as Generate>::generate(g),
)),
id::NAME_ITEM => Some(Self::NameItem(<NameItem as Generate>::generate(g))),
id::RESOURCE_PACK_RECEIVE => Some(Self::ResourcePackReceive(
<ResourcePackReceive as Generate>::generate(g),
)),
id::ADVANCEMENT_TAB => Some(Self::AdvancementTab(
<AdvancementTab as Generate>::generate(g),
)),
id::SELECT_TRADE => Some(Self::SelectTrade(<SelectTrade as Generate>::generate(g))),
id::SET_BEACON_EFFECT => Some(Self::SetBeaconEffect(
<SetBeaconEffect as Generate>::generate(g),
)),
id::HELD_ITEM_SLOT => Some(Self::HeldItemSlot(<HeldItemSlot as Generate>::generate(g))),
id::UPDATE_COMMAND_BLOCK => Some(Self::UpdateCommandBlock(
<UpdateCommandBlock as Generate>::generate(g),
)),
id::UPDATE_COMMAND_BLOCK_MINECART => Some(Self::UpdateCommandBlockMinecart(
<UpdateCommandBlockMinecart as Generate>::generate(g),
)),
id::SET_CREATIVE_SLOT => Some(Self::SetCreativeSlot(
<SetCreativeSlot as Generate>::generate(g),
)),
id::UPDATE_JIGSAW_BLOCK => Some(Self::UpdateJigsawBlock(
<UpdateJigsawBlock as Generate>::generate(g),
)),
id::UPDATE_STRUCTURE_BLOCK => Some(Self::UpdateStructureBlock(
<UpdateStructureBlock as Generate>::generate(g),
)),
id::UPDATE_SIGN => Some(Self::UpdateSign(<UpdateSign as Generate>::generate(g))),
id::ARM_ANIMATION => Some(Self::ArmAnimation(<ArmAnimation as Generate>::generate(g))),
id::SPECTATE => Some(Self::Spectate(<Spectate as Generate>::generate(g))),
id::BLOCK_PLACE => Some(Self::BlockPlace(<BlockPlace as Generate>::generate(g))),
id::USE_ITEM => Some(Self::UseItem(<UseItem as Generate>::generate(g))),
_ => None,
}
}
}