コード例 #1
0
        public ItemHandler(int size = 1)
        {
            Items = new Item[size];
            for (int i = 0; i < size; i++)
            {
                Items[i] = new Item();
            }

            Modes = new SlotMode[size];
        }
コード例 #2
0
        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;
                }
            }
        }
コード例 #3
0
 public ItemHandler(Item[] items)
 {
     Items = items;
     Modes = new SlotMode[items.Length];
 }