SaveInventory() static private method

static private SaveInventory ( System.Item inv ) : List
inv System.Item
return List
コード例 #1
0
ファイル: WorldIO.cs プロジェクト: Tea-Mod-Loader/Tea
        internal static List <TagCompound> SaveChests()
        {
            var list = new List <TagCompound>();

            for (int k = 0; k < 1000; k++)
            {
                var chest = Main.chest[k];
                if (chest == null)
                {
                    continue;
                }

                var itemTagList = PlayerIO.SaveInventory(chest.item);
                if (itemTagList == null)                 //doesn't need mod saving
                {
                    continue;
                }

                list.Add(new TagCompound {
                    ["items"] = itemTagList,
                    ["x"]     = chest.x,
                    ["y"]     = chest.y
                });
            }
            return(list);
        }
コード例 #2
0
        internal static List <TagCompound> SaveChestInventory()
        {
            var list = new List <TagCompound>();

            const short MaxChestSaveCount = 8000;             //As of Vanilla 1.4.0.1

            for (int k = 0; k < MaxChestSaveCount; k++)
            {
                var chest = Main.chest[k];
                if (chest == null)                 // chest doesn't exist
                {
                    continue;
                }

                var itemTagListModded = PlayerIO.SaveInventory(chest.item); // list of mod only items in inventory
                if (itemTagListModded == null)                              // Doesn't need additional saving beyond vanilla
                {
                    continue;
                }

                TagCompound tag = new TagCompound {
                    ["items"] = itemTagListModded,
                    ["x"]     = chest.x,
                    ["y"]     = chest.y,
                };

                list.Add(tag);
            }

            return(list);
        }