示例#1
0
        public static ChestRule Deserialize(TagCompound tag)
        {
            var rule = new ChestRulePool();

            rule.itemsToGenerate = tag.GetInt("ToGenerate");
            rule.pool            = DeserializePool(tag.GetCompound("Pool"));

            return(rule);
        }
示例#2
0
        public override ChestRule Clone()
        {
            var clone = new ChestRulePool();

            for (int k = 0; k < pool.Count; k++)
            {
                clone.pool.Add(pool[k].Clone());
            }

            clone.itemsToGenerate = itemsToGenerate;

            return(clone);
        }
示例#3
0
        public static ChestRule Deserialize(TagCompound tag)
        {
            string str = tag.GetString("Type");

            ChestRule rule;

            switch (str)
            {
            case "Guaranteed": rule = ChestRuleGuaranteed.Deserialize(tag); break;

            case "Chance": rule = ChestRuleChance.Deserialize(tag); break;

            case "Pool": rule = ChestRulePool.Deserialize(tag); break;

            case "PoolChance": rule = ChestRulePoolChance.Deserialize(tag); break;

            default: rule = null; break;
            }

            return(rule);
        }