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 {
|
pub struct ClickMode {
|
||||||
slot: Slot,
|
pub slot: Slot,
|
||||||
click_type: ClickType,
|
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 {
|
impl ClickMode {
|
||||||
@ -37,13 +46,13 @@ impl ClickMode {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
let button = match button {
|
let button = match button {
|
||||||
0 => Click::Left,
|
0 => MouseClick::Left,
|
||||||
1 => Click::Right,
|
1 => MouseClick::Right,
|
||||||
// TODO: Error here
|
// TODO: Error here
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
Self {
|
Self {
|
||||||
click_type: ClickType::NormalClick(button),
|
click_type: ClickType::MouseClick(button),
|
||||||
slot,
|
slot,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,8 +155,8 @@ impl ClickMode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ClickType {
|
pub enum ClickType {
|
||||||
NormalClick(Click),
|
MouseClick(MouseClick),
|
||||||
ShiftClick,
|
ShiftClick,
|
||||||
KeyClick(KeyClick),
|
KeyClick(KeyClick),
|
||||||
CreativePickItem,
|
CreativePickItem,
|
||||||
@ -158,34 +167,34 @@ enum ClickType {
|
|||||||
},
|
},
|
||||||
DoubleClick,
|
DoubleClick,
|
||||||
}
|
}
|
||||||
enum Click {
|
pub enum MouseClick {
|
||||||
Left,
|
Left,
|
||||||
Right,
|
Right,
|
||||||
Middle,
|
Middle,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum KeyClick {
|
pub enum KeyClick {
|
||||||
Slot(u8),
|
Slot(u8),
|
||||||
Offhand,
|
Offhand,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Slot {
|
pub enum Slot {
|
||||||
Normal(usize),
|
Normal(usize),
|
||||||
OutsideInventory,
|
OutsideInventory,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum DropType {
|
pub enum DropType {
|
||||||
SingleItem,
|
SingleItem,
|
||||||
FullStack,
|
FullStack,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum MouseDragType {
|
pub enum MouseDragType {
|
||||||
Left,
|
Left,
|
||||||
Right,
|
Right,
|
||||||
Middle,
|
Middle,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum MouseDragState {
|
pub enum MouseDragState {
|
||||||
Start,
|
Start,
|
||||||
AddSlot,
|
AddSlot,
|
||||||
End,
|
End,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use num_derive::{FromPrimitive, ToPrimitive};
|
use num_derive::{FromPrimitive, ToPrimitive};
|
||||||
|
|
||||||
mod container_click;
|
pub mod container_click;
|
||||||
pub mod player;
|
pub mod player;
|
||||||
pub mod window_property;
|
pub mod window_property;
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,7 @@ mod s_use_item_on;
|
|||||||
|
|
||||||
pub use s_chat_command::*;
|
pub use s_chat_command::*;
|
||||||
pub use s_chat_message::*;
|
pub use s_chat_message::*;
|
||||||
|
pub use s_click_container::*;
|
||||||
pub use s_client_information::*;
|
pub use s_client_information::*;
|
||||||
pub use s_close_container::*;
|
pub use s_close_container::*;
|
||||||
pub use s_confirm_teleport::*;
|
pub use s_confirm_teleport::*;
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
use pumpkin_core::text::TextComponent;
|
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::window_property::{WindowProperty, WindowPropertyTrait};
|
||||||
use pumpkin_inventory::WindowType;
|
use pumpkin_inventory::WindowType;
|
||||||
use pumpkin_protocol::client::play::{
|
use pumpkin_protocol::client::play::{
|
||||||
CCloseContainer, COpenScreen, CSetContainerContent, CSetContainerProperty, CSetContainerSlot,
|
CCloseContainer, COpenScreen, CSetContainerContent, CSetContainerProperty, CSetContainerSlot,
|
||||||
};
|
};
|
||||||
|
use pumpkin_protocol::server::play::SClickContainer;
|
||||||
use pumpkin_protocol::slot::Slot;
|
use pumpkin_protocol::slot::Slot;
|
||||||
use pumpkin_world::item::Item;
|
use pumpkin_world::item::Item;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user