public object ToNBT()
        {
            NBT nbt = new NBT();

            foreach (var e in Scores)
            {
                nbt.Set(e.Key.Name, e.Value);
            }
            return(nbt);
        }
Exemple #2
0
        public object ToNBT()
        {
            NBT nbt = new NBT();

            foreach (KeyValuePair <Effect, EffectCondition> e in Effects)
            {
                nbt.Set(e.Key.Id, e.Value);
            }
            return(nbt);
        }
        public string ToJson()
        {
            NBT display = new NBT()
                          .Set("title", Title)
                          .Set("description", Description)
                          .Set("icon", new NBT().Set("item", Icon?.Id).Set("nbt", Icon == null ? null : Icon.nbt.IsEmpty() ? null : Icon.nbt.ToString()))
                          .Set("frame", Frame.ToString().ToLower())
                          .Set("show_toast", ShowToast)
                          .Set("announce_to_chat", AnnounceToChat)
                          .Set("hidden", Hidden);
            NBT crits = new NBT();

            foreach (var e in Criteria)
            {
                crits.Set(e.Key, new NBT().Set("trigger", e.Value.Id).Set("conditions", e.Value));
            }
            return(new NBT().Set("display", display).Set("parent", Parent.Id).Set("criteria", crits).SetAny("requirements", requirements).Set("rewards", Reward).ToString(true, true));
        }