public static Load ( TagCompound tag ) : System.Item | ||
tag | TagCompound | |
Résultat | System.Item |
public static void LoadInventory(Item[] inv, IList <TagCompound> list) { foreach (var tag in list) { inv[tag.GetShort("slot")] = ItemIO.Load(tag); } }
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")); } }
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()}"); } } }
public static Item FromBase64(string base64) { MemoryStream ms = new MemoryStream(Convert.FromBase64String(base64)); return(ItemIO.Load(TagIO.FromStream(ms, true))); }