Minecraft-Console-Client/MinecraftClient/Inventory/Item.cs

54 lines
1.3 KiB
C#
Raw Normal View History

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>
/// Item Type
2020-03-28 15:01:08 +01:00
/// </summary>
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>
/// 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>
/// <param name="NBT">Item Metadata</param>
public Item(int id, int count, Dictionary<string, object> nbt)
2020-03-26 15:01:42 +08:00
{
this.Type = (ItemType)id;
this.Count = count;
this.NBT = nbt;
2020-03-26 15:01:42 +08:00
}
2020-03-28 15:01:08 +01:00
/// <summary>
/// Check if the item slot is empty
2020-03-28 15:01:08 +01:00
/// </summary>
/// <returns>TRUE if the item is empty</returns>
public bool IsEmpty
2020-03-26 15:01:42 +08:00
{
get
{
return Type == ItemType.Air || Count == 0;
}
2020-03-26 15:01:42 +08:00
}
}
}