/// <summary>Transfers a list of items into a tag as sub tag intems</summary> /// <typeparam name="T">The type of items to transfer</typeparam> /// <param name="List">The tag to receive the new sub tags</param> /// <param name="SubType">The sub tag type, must implement this <see cref="ITag"/></param> /// <param name="Source">The source of items to transfer</param> private static void Transfer <T>(ITag List, Type SubType, List <T> Source) { Int32 Count = Source.Count; ITag SubTag; for (Int32 I = 0; I < Count; I++) { SubTag = (ITag)Activator.CreateInstance(SubType); SubTag.SetValue(Source[I]); List.Add(SubTag); } }
/// <summary>Creates an this <see cref="ITag"/> that suits the given information</summary> /// <param name="Name">The name of the Tag</param> /// <param name="Value">The value of the receiving tag</param> /// <returns>Creates an this <see cref="ITag"/> that suits the given information</returns> public static ITag Create(String Name, List <Boolean> Value) { (ITag Out, Type TagType) = NBTTagFactory.CreateList(Name, NBTTagType.Byte); Int32 Count = Value.Count; ITag SubTag; for (Int32 I = 0; I < Count; I++) { SubTag = (ITag)Activator.CreateInstance(TagType); SubTag.SetValue((Byte)(Value[I] ? 1 : 0)); Out.Add(SubTag); } return(Out); }