make packet public and more abstraction thing
This commit is contained in:
parent
c408244b37
commit
c968131e04
@ -1,8 +1,17 @@
|
||||
#![allow(dead_code, unused)]
|
||||
use crate::WindowType;
|
||||
use pumpkin_world::item::Item;
|
||||
|
||||
pub struct ClickMode {
|
||||
slot: Slot,
|
||||
click_type: ClickType,
|
||||
pub slot: Slot,
|
||||
pub click_type: ClickType,
|
||||
}
|
||||
|
||||
pub struct Click {
|
||||
pub mode: ClickMode,
|
||||
pub state_id: u32,
|
||||
pub window_type: WindowType,
|
||||
pub changed_items: Vec<(usize, Item)>,
|
||||
pub carried_item: Option<Item>,
|
||||
}
|
||||
|
||||
impl ClickMode {
|
||||
@ -37,13 +46,13 @@ impl ClickMode {
|
||||
}
|
||||
};
|
||||
let button = match button {
|
||||
0 => Click::Left,
|
||||
1 => Click::Right,
|
||||
0 => MouseClick::Left,
|
||||
1 => MouseClick::Right,
|
||||
// TODO: Error here
|
||||
_ => unreachable!(),
|
||||
};
|
||||
Self {
|
||||
click_type: ClickType::NormalClick(button),
|
||||
click_type: ClickType::MouseClick(button),
|
||||
slot,
|
||||
}
|
||||
}
|
||||
@ -146,8 +155,8 @@ impl ClickMode {
|
||||
}
|
||||
}
|
||||
|
||||
enum ClickType {
|
||||
NormalClick(Click),
|
||||
pub enum ClickType {
|
||||
MouseClick(MouseClick),
|
||||
ShiftClick,
|
||||
KeyClick(KeyClick),
|
||||
CreativePickItem,
|
||||
@ -158,34 +167,34 @@ enum ClickType {
|
||||
},
|
||||
DoubleClick,
|
||||
}
|
||||
enum Click {
|
||||
pub enum MouseClick {
|
||||
Left,
|
||||
Right,
|
||||
Middle,
|
||||
}
|
||||
|
||||
enum KeyClick {
|
||||
pub enum KeyClick {
|
||||
Slot(u8),
|
||||
Offhand,
|
||||
}
|
||||
|
||||
enum Slot {
|
||||
pub enum Slot {
|
||||
Normal(usize),
|
||||
OutsideInventory,
|
||||
}
|
||||
|
||||
enum DropType {
|
||||
pub enum DropType {
|
||||
SingleItem,
|
||||
FullStack,
|
||||
}
|
||||
|
||||
enum MouseDragType {
|
||||
pub enum MouseDragType {
|
||||
Left,
|
||||
Right,
|
||||
Middle,
|
||||
}
|
||||
|
||||
enum MouseDragState {
|
||||
pub enum MouseDragState {
|
||||
Start,
|
||||
AddSlot,
|
||||
End,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
|
||||
mod container_click;
|
||||
pub mod container_click;
|
||||
pub mod player;
|
||||
pub mod window_property;
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ mod s_use_item_on;
|
||||
|
||||
pub use s_chat_command::*;
|
||||
pub use s_chat_message::*;
|
||||
pub use s_click_container::*;
|
||||
pub use s_client_information::*;
|
||||
pub use s_close_container::*;
|
||||
pub use s_confirm_teleport::*;
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
use pumpkin_core::text::TextComponent;
|
||||
use pumpkin_inventory::container_click;
|
||||
use pumpkin_inventory::container_click::KeyClick;
|
||||
use pumpkin_inventory::window_property::{WindowProperty, WindowPropertyTrait};
|
||||
use pumpkin_inventory::WindowType;
|
||||
use pumpkin_protocol::client::play::{
|
||||
CCloseContainer, COpenScreen, CSetContainerContent, CSetContainerProperty, CSetContainerSlot,
|
||||
};
|
||||
use pumpkin_protocol::server::play::SClickContainer;
|
||||
use pumpkin_protocol::slot::Slot;
|
||||
use pumpkin_world::item::Item;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user