public ItemHandler(int size = 1) { Items = new Item[size]; for (int i = 0; i < size; i++) { Items[i] = new Item(); } Modes = new SlotMode[size]; }
public void Load(TagCompound tag) { SetSize(tag.ContainsKey("Count") ? tag.GetInt("Count") : Slots); foreach (TagCompound compound in tag.GetList <TagCompound>("Items")) { Item item = ItemIO.Load(compound.GetCompound("Item")); int slot = compound.GetInt("Slot"); SlotMode mode = (SlotMode)compound.GetByte("Mode"); if (slot >= 0 && slot < Slots) { Items[slot] = item; Modes[slot] = mode; } } }
public ItemHandler(Item[] items) { Items = items; Modes = new SlotMode[items.Length]; }