public static ChestRule Deserialize(TagCompound tag) { var rule = new ChestRulePool(); rule.itemsToGenerate = tag.GetInt("ToGenerate"); rule.pool = DeserializePool(tag.GetCompound("Pool")); return(rule); }
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); }
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); }