mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Interact with inventories
The /inventory command allow listing inventory and clicking on items Should be enough for operating GUI menus such as Server chooser/teleporter
This commit is contained in:
parent
bc3d6aba00
commit
e04f06cece
13 changed files with 574 additions and 217 deletions
BIN
DebugTools/MinecraftClientProxy.suo
Normal file
BIN
DebugTools/MinecraftClientProxy.suo
Normal file
Binary file not shown.
|
|
@ -149,6 +149,22 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
g = readNextBool(ref packetData);
|
||||
Console.WriteLine("[C -> S] Location: " + x + ", " + y + ", " + z + ", (look)" + ", " + g);
|
||||
break;
|
||||
case 0x09:
|
||||
byte window = readNextByte(ref packetData);
|
||||
short slot = readNextShort(ref packetData);
|
||||
byte button = readNextByte(ref packetData);
|
||||
short action = readNextShort(ref packetData);
|
||||
int mode = readNextVarInt(ref packetData);
|
||||
bool slotPresent = readNextBool(ref packetData);
|
||||
int itemId = -1;
|
||||
byte itemCount = 0;
|
||||
if (slotPresent)
|
||||
{
|
||||
itemId = readNextVarInt(ref packetData);
|
||||
itemCount = readNextByte(ref packetData);
|
||||
}
|
||||
Console.WriteLine("[C -> S] Window #" + window + " click: #" + slot + " button " + button + " action " + action + " mode " + mode + " item " + itemId + " x" + itemCount);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -209,6 +225,19 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
return rawValue[0] != 0;
|
||||
}
|
||||
|
||||
private byte readNextByte(ref byte[] cache)
|
||||
{
|
||||
byte[] rawValue = readData(1, ref cache);
|
||||
return rawValue[0];
|
||||
}
|
||||
|
||||
private short readNextShort(ref byte[] cache)
|
||||
{
|
||||
byte[] rawValue = readData(2, ref cache);
|
||||
Array.Reverse(rawValue); //Endianness
|
||||
return BitConverter.ToInt16(rawValue, 0);
|
||||
}
|
||||
|
||||
private double readNextDouble(ref byte[] cache)
|
||||
{
|
||||
byte[] rawValue = readData(8, ref cache);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue