Esempio n. 1
0
 public static void AddCreativeItems(params Item[] items)
 {
     for (int i = 0; i < items.Length; ++i)
     {
         CreativeItemList.AddCreativeItem(items[i]);
     }
 }
Esempio n. 2
0
        public static void LoadCreativeItems()
        {
            string  data  = Encoding.UTF8.GetString(Resource.CreativeItems);
            JObject json  = JObject.Parse(data);
            JToken  items = json.GetValue("items");

            foreach (JObject item in items)
            {
                int    id     = item.Value <int>("id");
                int    damage = item.Value <int>("damage");
                string tags   = item.Value <string>("nbt_hex");
                byte[] nbt    = null;
                if (!string.IsNullOrEmpty(tags))
                {
                    nbt = tags.Chunks(2).Select(x => Convert.ToByte(new string(x.ToArray()), 16)).ToArray();
                }

                CreativeItemList.AddCreativeItem(Item.Get(id, damage, 1, nbt));
            }
        }