예제 #1
0
        /// <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, Boolean Value)
        {
            ITag Out = NBTTagFactory.Create(NBTTagType.Byte);

            Out.Name = Name;
            Out.SetInformation(NBTTagInformation.Value, (Byte)(Value ? 1 : 0));

            return(Out);
        }
예제 #2
0
        /// <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, Double Value)
        {
            ITag Out = NBTTagFactory.Create(NBTTagType.Double);

            Out.Name = Name;
            Out.SetInformation(NBTTagInformation.Value, Value);

            return(Out);
        }
예제 #3
0
        /// <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, Int64[] Value)
        {
            ITag Out = NBTTagFactory.Create(NBTTagType.LongArray);

            Out.Name = Name;
            Out.SetInformation(NBTTagInformation.Value, Value);

            return(Out);
        }
        /// <summary>Creates the specified list as a tag</summary>
        /// <param name="Name">The name of the list</param>
        /// <param name="SubType">The subtype to fill</param>
        /// <returns>Creates the specified list as a tag</returns>
        private static (ITag List, Type SubType) CreateList(String Name, NBTTagType SubType)
        {
            ITag Out = NBTTagFactory.Create(NBTTagType.List);

            Out.Name = Name;
            Out.SetInformation(NBTTagInformation.ListSubtype, SubType);
            Type TagType = NBTTagFactory.Types.ContainsKey(SubType) ? Types[SubType] : null;

            return(Out, TagType);
        }
        /// <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);
        }
예제 #6
0
        /// <summary>Creates a tag with the specified information</summary>
        /// <param name="type">The tag type</param>
        /// <param name="Name">The name of the tag</param>
        /// <param name="Value">The value of the type</param>
        /// <returns>Creates a tag with the specified tag type</returns>
        public static ITag Create(NBTTagType type, String Name, Object Value)
        {
            ITag Tag = NBTTagFactory.Create(type);

            if (Tag == null)
            {
                return(Tag);
            }

            if (Name != null)
            {
                Tag.Name = Name;
            }

            if (Value != null)
            {
                Tag.SetValue(Value);
            }

            return(Tag);
        }
 /// <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 <Single> Value)
 {
     (ITag Out, Type TagType) = NBTTagFactory.CreateList(Name, NBTTagType.Float);
     NBTTagFactory.Transfer(Out, TagType, Value);
     return(Out);
 }