use basalt_derive::{Decode, Encode, EncodedSize, packet};
use basalt_types::{NbtCompound, Position, Slot};
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x11)]
pub struct ServerboundPlayCloseWindow {
#[field(varint)]
pub window_id: i32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x25)]
pub struct ServerboundPlayCraftRecipeRequest {
#[field(varint)]
pub window_id: i32,
#[field(varint)]
pub recipe_id: i32,
pub make_all: bool,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x0f)]
pub struct ServerboundPlayEnchantItem {
#[field(varint)]
pub window_id: i32,
pub enchantment: i8,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x33)]
pub struct ServerboundPlayHeldItemSlot {
pub slot_id: i16,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x2e)]
pub struct ServerboundPlayNameItem {
pub name: String,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x22)]
pub struct ServerboundPlayPickItemFromBlock {
pub position: Position,
pub include_data: bool,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x23)]
pub struct ServerboundPlayPickItemFromEntity {
#[field(varint)]
pub entity_id: i32,
pub include_data: bool,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x02)]
pub struct ServerboundPlaySelectBundleItem {
#[field(varint)]
pub slot_id: i32,
#[field(varint)]
pub selected_item_index: i32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x31)]
pub struct ServerboundPlaySelectTrade {
#[field(varint)]
pub slot: i32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x32)]
pub struct ServerboundPlaySetBeaconEffect {
#[field(optional)]
pub primary_effect: Option<Vec<u8>>,
#[field(optional)]
pub secondary_effect: Option<Vec<u8>>,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x36)]
pub struct ServerboundPlaySetCreativeSlot {
pub slot: i16,
pub item: Slot,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x12)]
pub struct ServerboundPlaySetSlotState {
#[field(varint)]
pub slot_id: i32,
#[field(varint)]
pub window_id: i32,
pub state: bool,
}
#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
pub struct ServerboundPlayWindowClickChangedslots {
pub location: i16,
pub item: Slot,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x10)]
pub struct ServerboundPlayWindowClick {
#[field(varint)]
pub window_id: i32,
#[field(varint)]
pub state_id: i32,
pub slot: i16,
pub mouse_button: i8,
#[field(varint)]
pub mode: i32,
#[field(length = "varint")]
pub changed_slots: Vec<ServerboundPlayWindowClickChangedslots>,
pub cursor_item: Slot,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x12)]
pub struct ClientboundPlayCloseWindow {
#[field(varint)]
pub window_id: i32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x14)]
pub struct ClientboundPlayCraftProgressBar {
#[field(varint)]
pub window_id: i32,
pub property: i16,
pub value: i16,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x39)]
pub struct ClientboundPlayCraftRecipeResponse {
#[field(varint)]
pub window_id: i32,
pub recipe_display: crate::packets::play::types::RecipeDisplay,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x63)]
pub struct ClientboundPlayHeldItemSlot {
#[field(varint)]
pub slot: i32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x34)]
pub struct ClientboundPlayOpenBook {
#[field(varint)]
pub hand: i32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x24)]
pub struct ClientboundPlayOpenHorseWindow {
#[field(varint)]
pub window_id: i32,
#[field(varint)]
pub nb_slots: i32,
pub entity_id: i32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x36)]
pub struct ClientboundPlayOpenSignEntity {
pub location: Position,
pub is_front_text: bool,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x35)]
pub struct ClientboundPlayOpenWindow {
#[field(varint)]
pub window_id: i32,
#[field(varint)]
pub inventory_type: i32,
pub window_title: NbtCompound,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x17)]
pub struct ClientboundPlaySetCooldown {
pub cooldown_group: String,
#[field(varint)]
pub cooldown_ticks: i32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x5a)]
pub struct ClientboundPlaySetCursorItem {
pub contents: Slot,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x66)]
pub struct ClientboundPlaySetPlayerInventory {
#[field(varint)]
pub slot_id: i32,
pub contents: Slot,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x15)]
pub struct ClientboundPlaySetSlot {
#[field(varint)]
pub window_id: i32,
#[field(varint)]
pub state_id: i32,
pub slot: i16,
pub item: Slot,
}
#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
pub struct ClientboundPlayTradeListTradesInputitem1Slotcomponent {
#[field(varint)]
pub r#type: i32,
pub data: Vec<u8>,
}
#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
pub struct ClientboundPlayTradeListTradesInputitem1 {
#[field(varint)]
pub item_id: i32,
#[field(varint)]
pub item_count: i32,
#[field(varint)]
pub added_component_count: i32,
#[field(length = "varint")]
pub components: Vec<ClientboundPlayTradeListTradesInputitem1Slotcomponent>,
}
#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
pub struct ClientboundPlayTradeListTrades {
pub input_item1: ClientboundPlayTradeListTradesInputitem1,
pub output_item: Slot,
#[field(optional)]
pub input_item2: Option<Vec<u8>>,
pub trade_disabled: bool,
pub nb_trade_uses: i32,
pub maximum_nb_trade_uses: i32,
pub xp: i32,
pub special_price: i32,
pub price_multiplier: f32,
pub demand: i32,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x2e)]
pub struct ClientboundPlayTradeList {
#[field(varint)]
pub window_id: i32,
#[field(length = "varint")]
pub trades: Vec<ClientboundPlayTradeListTrades>,
#[field(varint)]
pub villager_level: i32,
#[field(varint)]
pub experience: i32,
pub is_regular_villager: bool,
pub can_restock: bool,
}
#[derive(Debug, Clone, Default, PartialEq)]
#[packet(id = 0x13)]
pub struct ClientboundPlayWindowItems {
#[field(varint)]
pub window_id: i32,
#[field(varint)]
pub state_id: i32,
#[field(length = "varint")]
pub items: Vec<Slot>,
pub carried_item: Slot,
}