public static void LoadLiquids(this ILiquidMachine machine, TagCompound tag) { if (tag.GetList <TagCompound>("machine_liquids") is List <TagCompound> tags && tags.Count == machine.LiquidEntries.Length) { for (int i = 0; i < machine.LiquidEntries.Length; i++) { machine.LiquidEntries[i].Load(tags[i]); } } }
public static void SaveLiquids(this ILiquidMachine machine, TagCompound existing) { existing.Add("machine_liquids", machine.LiquidEntries?.Select(entry => entry.Save()).ToList()); }