use basalt_derive::{Decode, Encode, EncodedSize, packet};
use basalt_types::{NbtCompound, Uuid};
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x26)]
pub struct ServerboundPlayAbilities {
pub flags: i8,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x0a)]
pub struct ServerboundPlayClientCommand {
#[field(varint)]
pub action_id: i32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x1f)]
pub struct ServerboundPlayFlying {
pub flags: u8,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x1b)]
pub struct ServerboundPlayLockDifficulty {
pub locked: bool,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x1e)]
pub struct ServerboundPlayLook {
pub yaw: f32,
pub pitch: f32,
pub flags: u8,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x29)]
pub struct ServerboundPlayPlayerInput {
pub inputs: u8,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x2a)]
pub struct ServerboundPlayPlayerLoaded;
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x1c)]
pub struct ServerboundPlayPosition {
pub x: f64,
pub y: f64,
pub z: f64,
pub flags: u8,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x1d)]
pub struct ServerboundPlayPositionLook {
pub x: f64,
pub y: f64,
pub z: f64,
pub yaw: f32,
pub pitch: f32,
pub flags: u8,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x03)]
pub struct ServerboundPlaySetDifficulty {
pub new_difficulty: u8,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x3b)]
pub struct ServerboundPlaySpectate {
pub target: Uuid,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x21)]
pub struct ServerboundPlaySteerBoat {
pub left_paddle: bool,
pub right_paddle: bool,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x00)]
pub struct ServerboundPlayTeleportConfirm {
#[field(varint)]
pub teleport_id: i32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x20)]
pub struct ServerboundPlayVehicleMove {
pub x: f64,
pub y: f64,
pub z: f64,
pub yaw: f32,
pub pitch: f32,
pub on_ground: bool,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x3a)]
pub struct ClientboundPlayAbilities {
pub flags: i8,
pub flying_speed: f32,
pub walking_speed: f32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x57)]
pub struct ClientboundPlayCamera {
#[field(varint)]
pub camera_id: i32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x3e)]
pub struct ClientboundPlayDeathCombatEvent {
#[field(varint)]
pub player_id: i32,
pub message: NbtCompound,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x0b)]
pub struct ClientboundPlayDifficulty {
pub difficulty: u8,
pub difficulty_locked: bool,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x3c)]
pub struct ClientboundPlayEndCombatEvent {
#[field(varint)]
pub duration: i32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x3d)]
pub struct ClientboundPlayEnterCombatEvent;
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x61)]
pub struct ClientboundPlayExperience {
pub experience_bar: f32,
#[field(varint)]
pub level: i32,
#[field(varint)]
pub total_experience: i32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x41)]
pub struct ClientboundPlayFacePlayer {
#[field(varint)]
pub feet_eyes: i32,
pub x: f64,
pub y: f64,
pub z: f64,
pub is_entity: bool,
pub entity_id: Vec<u8>,
pub entity_feet_eyes: Vec<u8>,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x23)]
pub struct ClientboundPlayGameStateChange {
pub reason: u8,
pub game_mode: f32,
}
#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
pub struct ClientboundPlayLoginSpawninfo {
#[field(varint)]
pub dimension: i32,
pub name: String,
pub hashed_seed: i64,
pub gamemode: i8,
pub previous_gamemode: u8,
pub is_debug: bool,
pub is_flat: bool,
#[field(optional)]
pub death: Option<Vec<u8>>,
#[field(varint)]
pub portal_cooldown: i32,
#[field(varint)]
pub sea_level: i32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x2c)]
pub struct ClientboundPlayLogin {
pub entity_id: i32,
pub is_hardcore: bool,
#[field(length = "varint")]
pub world_names: Vec<String>,
#[field(varint)]
pub max_players: i32,
#[field(varint)]
pub view_distance: i32,
#[field(varint)]
pub simulation_distance: i32,
pub reduced_debug_info: bool,
pub enable_respawn_screen: bool,
pub do_limited_crafting: bool,
pub world_state: ClientboundPlayLoginSpawninfo,
pub enforces_secure_chat: bool,
}
#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
pub struct ClientboundPlayPlayerChatPreviousmessages {
#[field(varint)]
pub id: i32,
pub signature: Vec<u8>,
}
#[derive(Debug, Clone, PartialEq, Encode, Decode, EncodedSize)]
pub enum ClientboundPlayPlayerChatFiltertype {
#[variant(id = 2)]
Variant2 {
#[field(length = "varint")]
filter_type_mask: Vec<i64>,
},
}
impl Default for ClientboundPlayPlayerChatFiltertype {
fn default() -> Self {
Self::Variant2 {
filter_type_mask: Default::default(),
}
}
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x3b)]
pub struct ClientboundPlayPlayerChat {
pub sender_uuid: Uuid,
#[field(varint)]
pub index: i32,
#[field(optional)]
pub signature: Option<Vec<u8>>,
pub plain_message: String,
pub timestamp: i64,
pub salt: i64,
#[field(length = "varint")]
pub previous_messages: Vec<ClientboundPlayPlayerChatPreviousmessages>,
#[field(optional)]
pub unsigned_chat_content: Option<NbtCompound>,
pub filter_type: ClientboundPlayPlayerChatFiltertype,
pub r#type: Vec<u8>,
pub network_name: NbtCompound,
#[field(optional)]
pub network_target_name: Option<NbtCompound>,
}
#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
pub struct ClientboundPlayPlayerInfoData {
pub uuid: Uuid,
#[field(rest)]
pub remaining: Vec<u8>,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x40)]
pub struct ClientboundPlayPlayerInfo {
pub action: u8,
#[field(length = "varint")]
pub data: Vec<ClientboundPlayPlayerInfoData>,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x3f)]
pub struct ClientboundPlayPlayerRemove {
#[field(length = "varint")]
pub players: Vec<Uuid>,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x43)]
pub struct ClientboundPlayPlayerRotation {
pub yaw: f32,
pub pitch: f32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x42)]
pub struct ClientboundPlayPosition {
#[field(varint)]
pub teleport_id: i32,
pub x: f64,
pub y: f64,
pub z: f64,
pub dx: f64,
pub dy: f64,
pub dz: f64,
pub yaw: f32,
pub pitch: f32,
pub flags: u32,
}
#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
pub struct ClientboundPlayRespawnSpawninfo {
#[field(varint)]
pub dimension: i32,
pub name: String,
pub hashed_seed: i64,
pub gamemode: i8,
pub previous_gamemode: u8,
pub is_debug: bool,
pub is_flat: bool,
#[field(optional)]
pub death: Option<Vec<u8>>,
#[field(varint)]
pub portal_cooldown: i32,
#[field(varint)]
pub sea_level: i32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x4c)]
pub struct ClientboundPlayRespawn {
pub world_state: ClientboundPlayRespawnSpawninfo,
pub copy_metadata: u8,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x69)]
pub struct ClientboundPlaySimulationDistance {
#[field(varint)]
pub distance: i32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x62)]
pub struct ClientboundPlayUpdateHealth {
pub health: f32,
#[field(varint)]
pub food: i32,
pub food_saturation: f32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x33)]
pub struct ClientboundPlayVehicleMove {
pub x: f64,
pub y: f64,
pub z: f64,
pub yaw: f32,
pub pitch: f32,
}