コード例 #1
0
        public PlayerInventory(Player player) : base(player, 36)
        {
            this.PlayerCursorInventory     = new PlayerCursorInventory(player);
            this.PlayerEnderChestInventory = new PlayerEnderChestInventory(player);

            this.CraftingGridInventory = new CraftingGridInventory(player);
        }
コード例 #2
0
        public PlayerInventory(Player player) : base(player, 36)
        {
            if (!player.NamedTag.Exist("Inventory"))
            {
                ListTag initItems = new ListTag("Inventory", NBTTagType.COMPOUND);
                for (int i = 0; i < this.Size; ++i)
                {
                    initItems.Add(NBTIO.WriteItem(Item.Get(0, 0, 0), i));
                }
                player.NamedTag.PutList(initItems);
            }

            ListTag items = player.NamedTag.GetList("Inventory");

            for (int i = 0; i < this.Size; ++i)
            {
                Item item = NBTIO.ReadItem((CompoundTag)items[i]);
                this.SetItem(i, item, false);
            }

            this.PlayerCursorInventory     = new PlayerCursorInventory(player);
            this.PlayerEnderChestInventory = new PlayerEnderChestInventory(player);

            this.CraftingGridInventory = new CraftingGridInventory(player);
        }