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:
ORelio 2020-03-29 18:41:26 +02:00
parent bc3d6aba00
commit e04f06cece
13 changed files with 574 additions and 217 deletions

View file

@ -20,44 +20,34 @@ namespace MinecraftClient.Inventory
/// </summary>
public int Count;
/// <summary>
/// Slot ID in the parent inventory
/// </summary>
/// <remarks>-1 means currently being dragged by mouse</remarks>
public int SlotID;
/// <summary>
/// Item Metadata
/// </summary>
public Dictionary<string, object> NBT;
/// <summary>
/// Create an item with Type ID, Count and Slot ID
/// Create an item with Type ID, Count and Metadata
/// </summary>
/// <param name="ID">Item Type ID</param>
/// <param name="Count">Item Count</param>
/// <param name="SlotID">Item Slot ID in parent inventory</param>
public Item(int id, int count, int slotID)
/// <param name="NBT">Item Metadata</param>
public Item(int id, int count, Dictionary<string, object> nbt)
{
this.Type = (ItemType)id;
this.Count = count;
this.SlotID = slotID;
this.NBT = new Dictionary<string, object>();
this.NBT = nbt;
}
/// <summary>
/// Create an item with Type ID, Count, Slot ID and Metadata
/// Check if the item slot is empty
/// </summary>
/// <param name="ID">Item Type ID</param>
/// <param name="Count">Item Count</param>
/// <param name="SlotID">Item Slot ID in parent inventory</param>
/// <param name="NBT">Item Metadata</param>
public Item(int id, int count, int slotID, Dictionary<string, object> nbt)
/// <returns>TRUE if the item is empty</returns>
public bool IsEmpty
{
this.Type = (ItemType)id;
this.Count = count;
this.SlotID = slotID;
this.NBT = nbt;
get
{
return Type == ItemType.Air || Count == 0;
}
}
}
}