This commit is contained in:
Edvin Bryntesson committed 2024-08-24 20:05:49 +02:00
1 parent 83231f4271
commit c408244b37
2 files changed
+20 -18

No files matched your search

+19 -17
View File
@@ -1,3 +1,5 @@
#![allow(dead_code, unused)]
pub struct ClickMode { pub struct ClickMode {
slot: Slot, slot: Slot,
click_type: ClickType, click_type: ClickType,
@@ -35,8 +37,8 @@ impl ClickMode {
} }
}; };
let button = match button { let button = match button {
0 => Click::LeftClick, 0 => Click::Left,
1 => Click::RightClick, 1 => Click::Right,
// TODO: Error here // TODO: Error here
_ => unreachable!(), _ => unreachable!(),
}; };
@@ -84,50 +86,50 @@ impl ClickMode {
fn new_drag_item(button: i8, slot: i16) -> Self { fn new_drag_item(button: i8, slot: i16) -> Self {
let (mouse_type, state, slot) = match button { let (mouse_type, state, slot) = match button {
0 => ( 0 => (
MouseDragType::LeftMouse, MouseDragType::Left,
MouseDragState::Start, MouseDragState::Start,
Slot::OutsideInventory, Slot::OutsideInventory,
), ),
1 => ( 1 => (
MouseDragType::LeftMouse, MouseDragType::Left,
MouseDragState::AddSlot, MouseDragState::AddSlot,
Slot::Normal(slot.try_into().unwrap()), Slot::Normal(slot.try_into().unwrap()),
), ),
2 => ( 2 => (
MouseDragType::LeftMouse, MouseDragType::Left,
MouseDragState::End, MouseDragState::End,
Slot::OutsideInventory, Slot::OutsideInventory,
), ),
4 => ( 4 => (
MouseDragType::RightMouse, MouseDragType::Right,
MouseDragState::Start, MouseDragState::Start,
Slot::OutsideInventory, Slot::OutsideInventory,
), ),
5 => ( 5 => (
MouseDragType::RightMouse, MouseDragType::Right,
MouseDragState::AddSlot, MouseDragState::AddSlot,
Slot::Normal(slot.try_into().unwrap()), Slot::Normal(slot.try_into().unwrap()),
), ),
6 => ( 6 => (
MouseDragType::RightMouse, MouseDragType::Right,
MouseDragState::End, MouseDragState::End,
Slot::OutsideInventory, Slot::OutsideInventory,
), ),
// ONLY FOR CREATIVE // ONLY FOR CREATIVE
8 => ( 8 => (
MouseDragType::MiddleMouse, MouseDragType::Middle,
MouseDragState::Start, MouseDragState::Start,
Slot::OutsideInventory, Slot::OutsideInventory,
), ),
9 => ( 9 => (
MouseDragType::MiddleMouse, MouseDragType::Middle,
MouseDragState::AddSlot, MouseDragState::AddSlot,
Slot::Normal(slot.try_into().unwrap()), Slot::Normal(slot.try_into().unwrap()),
), ),
10 => ( 10 => (
MouseDragType::MiddleMouse, MouseDragType::Middle,
MouseDragState::End, MouseDragState::End,
Slot::OutsideInventory, Slot::OutsideInventory,
), ),
@@ -157,9 +159,9 @@ enum ClickType {
DoubleClick, DoubleClick,
} }
enum Click { enum Click {
LeftClick, Left,
RightClick, Right,
MiddleClick, Middle,
} }
enum KeyClick { enum KeyClick {
@@ -178,9 +180,9 @@ enum DropType {
} }
enum MouseDragType { enum MouseDragType {
LeftMouse, Left,
RightMouse, Right,
MiddleMouse, Middle,
} }
enum MouseDragState { enum MouseDragState {
@@ -2,7 +2,7 @@ use crate::slot::Slot;
use crate::VarInt; use crate::VarInt;
use pumpkin_macros::packet; use pumpkin_macros::packet;
use serde::Deserialize; use serde::Deserialize;
#[allow(dead_code)]
#[derive(Deserialize)] #[derive(Deserialize)]
#[packet(0x0E)] #[packet(0x0E)]
pub struct SClickContainer { pub struct SClickContainer {