diff --git a/MinecraftClient/Inventory/WindowActionType.cs b/MinecraftClient/Inventory/WindowActionType.cs
index e826a691..97e281fd 100644
--- a/MinecraftClient/Inventory/WindowActionType.cs
+++ b/MinecraftClient/Inventory/WindowActionType.cs
@@ -5,13 +5,84 @@ using System.Text;
namespace MinecraftClient.Inventory
{
+ ///
+ /// Represents mouse interactions with an inventory window
+ ///
public enum WindowActionType
{
+ ///
+ /// Left click with mouse on a slot: grab or drop a whole item stack
+ ///
LeftClick,
+
+ ///
+ /// Right click with mouse on a slot: grab half a stack or drop a single item
+ ///
RightClick,
+
+ ///
+ /// Middle click with mouse on a slot: grab a full stack from creative inventory
+ ///
MiddleClick,
+
+ ///
+ /// Shift+Left click with mouse on a slot: send a whole item stack to the hotbar or other inventory
+ ///
ShiftClick,
+
+ ///
+ /// Drop a single item on ground after grabbing an item stack
+ ///
DropItem,
- DropItemStack
+
+ ///
+ /// Drop a whole item stack on ground after grabbing it
+ ///
+ DropItemStack,
+
+ ///
+ /// Start hovering slots with left button pressed: Distribute evenly the stack on hovered slots
+ ///
+ StartDragLeft,
+
+ ///
+ /// Start hovering slots with right button pressed: Drop one item on each hovered slot
+ ///
+ StartDragRight,
+
+ ///
+ /// Start hovering slots with middle button pressed: Create one item stack on each hovered slot in creative mode
+ ///
+ StartDragMiddle,
+
+ ///
+ /// Hover a slot to distribute evenly an item stack
+ ///
+ AddDragLeft,
+
+ ///
+ /// Hover a slot to drop one item from an item stack
+ ///
+ AddDragRight,
+
+ ///
+ /// Hover a slot to create one item stack in creative mode
+ ///
+ AddDragMiddle,
+
+ ///
+ /// Stop hovering slots with left button pressed
+ ///
+ EndDragLeft,
+
+ ///
+ /// Stop hovering slots with right button pressed
+ ///
+ EndDragRight,
+
+ ///
+ /// Stop hovering slots with middble button pressed
+ ///
+ EndDragMiddle,
}
}
diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs
index a9f67407..e125a84b 100644
--- a/MinecraftClient/Protocol/Handlers/Protocol18.cs
+++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs
@@ -1609,6 +1609,7 @@ namespace MinecraftClient.Protocol.Handlers
catch (System.IO.IOException) { return false; }
catch (ObjectDisposedException) { return false; }
}
+
public bool SendWindowAction(int windowId, int slotId, WindowActionType action, Item item)
{
try
@@ -1624,22 +1625,24 @@ namespace MinecraftClient.Protocol.Handlers
byte button = 0;
byte mode = 0;
+
switch (action)
{
- case WindowActionType.LeftClick: button = 0; break;
- case WindowActionType.RightClick: button = 1; break;
- case WindowActionType.MiddleClick: button = 2; mode = 3; break;
- case WindowActionType.ShiftClick: button = 0; mode = 1; item = new Item(-1, 0, null); break;
- case WindowActionType.DropItem:
- button = 0;
- mode = 4;
- item = new Item(-1, 0, null);
- break;
- case WindowActionType.DropItemStack:
- button = 1;
- mode = 4;
- item = new Item(-1, 0, null);
- break;
+ case WindowActionType.LeftClick: button = 0; break;
+ case WindowActionType.RightClick: button = 1; break;
+ case WindowActionType.MiddleClick: button = 2; mode = 3; break;
+ case WindowActionType.ShiftClick: button = 0; mode = 1; item = new Item(-1, 0, null); break;
+ case WindowActionType.DropItem: button = 0; mode = 4; item = new Item(-1, 0, null); break;
+ case WindowActionType.DropItemStack: button = 1; mode = 4; item = new Item(-1, 0, null); break;
+ case WindowActionType.StartDragLeft: button = 0; mode = 5; item = new Item(-1, 0, null); slotId = -999; break;
+ case WindowActionType.StartDragRight: button = 4; mode = 5; item = new Item(-1, 0, null); slotId = -999; break;
+ case WindowActionType.StartDragMiddle: button = 8; mode = 5; item = new Item(-1, 0, null); slotId = -999; break;
+ case WindowActionType.EndDragLeft: button = 2; mode = 5; item = new Item(-1, 0, null); slotId = -999; break;
+ case WindowActionType.EndDragRight: button = 6; mode = 5; item = new Item(-1, 0, null); slotId = -999; break;
+ case WindowActionType.EndDragMiddle: button = 10; mode = 5; item = new Item(-1, 0, null); slotId = -999; break;
+ case WindowActionType.AddDragLeft: button = 1; mode = 5; item = new Item(-1, 0, null); break;
+ case WindowActionType.AddDragRight: button = 5; mode = 5; item = new Item(-1, 0, null); break;
+ case WindowActionType.AddDragMiddle: button = 9; mode = 5; item = new Item(-1, 0, null); break;
}
List packet = new List();