mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Implemented basic player inventory items handle
This commit is contained in:
parent
51d03b9ced
commit
8b8f3a719b
3 changed files with 44 additions and 1 deletions
|
|
@ -510,8 +510,11 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
break;
|
||||
case PacketIncomingType.WindowItems:
|
||||
if (handler.GetInventoryEnabled())
|
||||
if (handler.GetInventoryEnabled()||true)
|
||||
{
|
||||
/*
|
||||
* Following commented code not working
|
||||
*
|
||||
byte id = dataTypes.ReadNextByte(packetData);
|
||||
short elements = dataTypes.ReadNextShort(packetData);
|
||||
|
||||
|
|
@ -528,6 +531,24 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
dataTypes.ReadNextNbt(packetData);
|
||||
}
|
||||
}
|
||||
*/
|
||||
byte id = dataTypes.ReadNextByte(packetData);
|
||||
short elements = dataTypes.ReadNextShort(packetData);
|
||||
Dictionary<int, Item> itemsList = new Dictionary<int, Item>(); // index is SlotID
|
||||
for(int i = 0; i < elements; i++)
|
||||
{
|
||||
bool haveItem = dataTypes.ReadNextBool(packetData);
|
||||
if (haveItem)
|
||||
{
|
||||
int itemID = dataTypes.ReadNextVarInt(packetData);
|
||||
byte itemCount = dataTypes.ReadNextByte(packetData);
|
||||
dataTypes.ReadNextNbt(packetData);
|
||||
|
||||
Item item = new Item(itemID, itemCount);
|
||||
itemsList.Add(i, item);
|
||||
}
|
||||
}
|
||||
handler.OnWindowItems(id, itemsList);
|
||||
}
|
||||
break;
|
||||
case PacketIncomingType.ResourcePackSend:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue