2020-03-26 15:01:42 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
|
|
namespace MinecraftClient.Inventory
|
|
|
|
|
|
{
|
2020-03-28 15:01:08 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Represents an item inside a Container
|
|
|
|
|
|
/// </summary>
|
2020-03-26 15:01:42 +08:00
|
|
|
|
public class Item
|
|
|
|
|
|
{
|
2020-03-28 15:01:08 +01:00
|
|
|
|
/// <summary>
|
2020-03-28 23:30:17 +01:00
|
|
|
|
/// Item Type
|
2020-03-28 15:01:08 +01:00
|
|
|
|
/// </summary>
|
2020-03-28 23:30:17 +01:00
|
|
|
|
public ItemType Type;
|
2020-03-28 15:01:08 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Item Count
|
|
|
|
|
|
/// </summary>
|
2020-03-26 15:01:42 +08:00
|
|
|
|
public int Count;
|
2020-03-28 15:01:08 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Item Metadata
|
|
|
|
|
|
/// </summary>
|
2020-03-26 15:01:42 +08:00
|
|
|
|
public Dictionary<string, object> NBT;
|
|
|
|
|
|
|
2020-03-28 15:01:08 +01:00
|
|
|
|
/// <summary>
|
2020-03-29 18:41:26 +02:00
|
|
|
|
/// Create an item with Type ID, Count and Metadata
|
2020-03-28 15:01:08 +01:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="ID">Item Type ID</param>
|
|
|
|
|
|
/// <param name="Count">Item Count</param>
|
2020-03-29 18:41:26 +02:00
|
|
|
|
/// <param name="NBT">Item Metadata</param>
|
|
|
|
|
|
public Item(int id, int count, Dictionary<string, object> nbt)
|
2020-03-26 15:01:42 +08:00
|
|
|
|
{
|
2020-03-28 23:30:17 +01:00
|
|
|
|
this.Type = (ItemType)id;
|
2020-03-28 17:56:17 +01:00
|
|
|
|
this.Count = count;
|
2020-03-29 18:41:26 +02:00
|
|
|
|
this.NBT = nbt;
|
2020-03-26 15:01:42 +08:00
|
|
|
|
}
|
2020-03-28 15:01:08 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2020-03-29 18:41:26 +02:00
|
|
|
|
/// Check if the item slot is empty
|
2020-03-28 15:01:08 +01:00
|
|
|
|
/// </summary>
|
2020-03-29 18:41:26 +02:00
|
|
|
|
/// <returns>TRUE if the item is empty</returns>
|
|
|
|
|
|
public bool IsEmpty
|
2020-03-26 15:01:42 +08:00
|
|
|
|
{
|
2020-03-29 18:41:26 +02:00
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return Type == ItemType.Air || Count == 0;
|
|
|
|
|
|
}
|
2020-03-26 15:01:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|