Implemented basic player inventory items handle

This commit is contained in:
ReinforceZwei 2020-03-22 23:19:31 +08:00 committed by ORelio
parent 51d03b9ced
commit 8b8f3a719b
3 changed files with 44 additions and 1 deletions

View file

@ -57,6 +57,9 @@ namespace MinecraftClient
private object lastKeepAliveLock = new object();
private int playerEntityID;
// not really understand the Inventory Class
// so I use a Dict instead for player inventory
private Dictionary<int, Item> playerItems;
// auto attack
private class Entity
@ -763,6 +766,23 @@ namespace MinecraftClient
}
}
/// <summary>
/// When received window items from server.
/// </summary>
/// <param name="type"></param>
/// <param name="itemList"></param>
public void OnWindowItems(int type, Dictionary<int, Item> itemList)
{
// player inventory
//if (type == 0)
// playerItems = itemList;
foreach(KeyValuePair<int,Item> pair in itemList)
{
ConsoleIO.WriteLine("Slot: "+pair.Key+" itemID:"+pair.Value.id);
}
ConsoleIO.WriteLine("Type: "+type);
}
/// <summary>
/// When connection has been lost, login was denied or played was kicked from the server
/// </summary>