public static ChestRule Deserialize(TagCompound tag) { var rule = new ChestRulePoolChance(); rule.itemsToGenerate = tag.GetInt("ToGenerate"); rule.chance = tag.GetFloat("Chance"); rule.pool = DeserializePool(tag.GetCompound("Pool")); return(rule); }
public override ChestRule Clone() { var clone = new ChestRulePoolChance(); for (int k = 0; k < pool.Count; k++) { clone.pool.Add(pool[k].Clone()); } clone.itemsToGenerate = itemsToGenerate; clone.chance = chance; 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); }