mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
tmp commit
This commit is contained in:
parent
a51368a859
commit
82fb081828
3 changed files with 74 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using MinecraftClient.Inventory;
|
||||
using MinecraftClient.Mapping;
|
||||
|
||||
namespace MinecraftClient.ChatBots
|
||||
{
|
||||
|
|
@ -11,9 +12,45 @@ namespace MinecraftClient.ChatBots
|
|||
private bool waitingForResult = false;
|
||||
private int inventoryInUse;
|
||||
|
||||
private enum ActionType
|
||||
{
|
||||
MoveTo,
|
||||
WaitForUpdate,
|
||||
Repeat
|
||||
}
|
||||
|
||||
private class ActionStep
|
||||
{
|
||||
public ActionType Action;
|
||||
public int Slot;
|
||||
public int InventoryID;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
RegisterChatBotCommand("craft", "craft", CraftCommand);
|
||||
RegisterChatBotCommand("open", "open", Open);
|
||||
RegisterChatBotCommand("place", "place", Place);
|
||||
}
|
||||
|
||||
public string Open(string command, string[] args)
|
||||
{
|
||||
double x = -258;
|
||||
double y = 64;
|
||||
double z = -187;
|
||||
Location l = new Location(x, y, z);
|
||||
SendPlaceBlock(l, Direction.Up);
|
||||
SendAnimation();
|
||||
return "Try to open";
|
||||
}
|
||||
|
||||
public string Place(string command, string[] args)
|
||||
{
|
||||
double x = Convert.ToDouble(args[0]);
|
||||
double y = Convert.ToDouble(args[1]);
|
||||
double z = Convert.ToDouble(args[2]);
|
||||
SendPlaceBlock(new Location(x, y, z), Direction.Down);
|
||||
return "Try place";
|
||||
}
|
||||
|
||||
public string CraftCommand(string command, string[] args)
|
||||
|
|
@ -29,6 +66,7 @@ namespace MinecraftClient.ChatBots
|
|||
foreach (KeyValuePair<int, ItemType> slot in recipe)
|
||||
{
|
||||
slotToPut = slot.Key + 1;
|
||||
slotToTake = -2;
|
||||
// Find material in our inventory
|
||||
foreach (KeyValuePair<int, Item> item in inventory.Items)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ namespace MinecraftClient.Inventory
|
|||
LeftClick,
|
||||
RightClick,
|
||||
MiddleClick,
|
||||
ShiftClick,
|
||||
DropItem,
|
||||
DropItemStack
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1112,6 +1112,41 @@ namespace MinecraftClient
|
|||
}
|
||||
}
|
||||
break;
|
||||
case WindowActionType.ShiftClick:
|
||||
if (inventory.Items.ContainsKey(slotId))
|
||||
{
|
||||
/* Target slot have item */
|
||||
|
||||
// Cursor have item or not doesn't matter
|
||||
switch (inventory.Type)
|
||||
{
|
||||
case ContainerType.PlayerInventory: // Shift click within player inventory
|
||||
// If hotbar already have same item, will put on it first until every stack are full
|
||||
// If no more same item , will put on the first empty slot (smaller slot id)
|
||||
// If inventory full, item will not move
|
||||
if (slotId < 36)
|
||||
{
|
||||
// Clicked slot is on upper side inventory, put it to hotbar
|
||||
foreach(KeyValuePair<int, Item> _item in playerInventory.Items)
|
||||
{
|
||||
if (_item.Key < 35) continue;
|
||||
|
||||
if (_item.Value.Type == inventory.Items[slotId].Type && _item.Value.Count < 64)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Clicked slot is on hotbar, put it to upper inventory
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WindowActionType.DropItem:
|
||||
if (inventory.Items.ContainsKey(slotId))
|
||||
inventory.Items[slotId].Count--;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue