Load() public static méthode

public static Load ( TagCompound tag ) : System.Item
tag TagCompound
Résultat System.Item
Exemple #1
0
 public static void LoadInventory(Item[] inv, IList <TagCompound> list)
 {
     foreach (var tag in list)
     {
         inv[tag.GetShort("slot")] = ItemIO.Load(tag);
     }
 }
Exemple #2
0
        internal static void LoadContainers(TagCompound tag)
        {
            if (tag.ContainsKey("data"))
            {
                ReadContainers(new BinaryReader(new MemoryStream(tag.GetByteArray("data"))));
            }

            foreach (var frameTag in tag.GetList <TagCompound>("itemFrames"))
            {
                TEItemFrame itemFrame = TileEntity.ByID[tag.GetInt("id")] as TEItemFrame;
                ItemIO.Load(itemFrame.item, frameTag.GetCompound("item"));
            }
        }
Exemple #3
0
        internal static void LoadContainers(TagCompound tag)
        {
            if (tag.ContainsKey("data"))
            {
                ReadContainers(new BinaryReader(new MemoryStream(tag.GetByteArray("data"))));
            }

            foreach (var frameTag in tag.GetList <TagCompound>("itemFrames"))
            {
                if (TileEntity.ByID.TryGetValue(frameTag.GetInt("id"), out TileEntity tileEntity) && tileEntity is TEItemFrame itemFrame)
                {
                    ItemIO.Load(itemFrame.item, frameTag.GetCompound("item"));
                }
                else
                {
                    Logging.tML.Warn($"Due to a bug in previous versions of tModLoader, the following ItemFrame data has been lost: {frameTag.ToString()}");
                }
            }
        }
Exemple #4
0
        public static Item FromBase64(string base64)
        {
            MemoryStream ms = new MemoryStream(Convert.FromBase64String(base64));

            return(ItemIO.Load(TagIO.FromStream(ms, true)));
        }