public EntityMob(TypedEntity e) : base(e) { EntityMob e2 = e as EntityMob; if (e2 != null) { _attackTime = e2._attackTime; _deathTime = e2._deathTime; _health = e2._health; _hurtTime = e2._hurtTime; _activeEffects = e2._activeEffects; } }
protected EntityMob(string id) : base(id) { _activeEffects = new ActiveEffects(); }
public override TypedEntity LoadTree(TagNode tree) { TagNodeCompound ctree = tree as TagNodeCompound; if (ctree == null || base.LoadTree(tree) == null) { return null; } _attackTime = ctree["AttackTime"].ToTagShort(); _deathTime = ctree["DeathTime"].ToTagShort(); _health = ctree["Health"].ToTagShort(); _hurtTime = ctree["HurtTime"].ToTagShort(); if (ctree.ContainsKey("ActiveEffects")) { TagNodeCompound ae = ctree["ActiveEffects"].ToTagCompound(); _activeEffects = new ActiveEffects(); _activeEffects.Id = ae["Id"].ToTagByte(); _activeEffects.Amplifier = ae["Amplifier"].ToTagByte(); _activeEffects.Duration = ae["Duration"].ToTagInt(); } return this; }
public override TypedEntity LoadTree(TagNode tree) { TagNodeCompound ctree = tree as TagNodeCompound; if (ctree == null || base.LoadTree(tree) == null) { return(null); } _attackTime = ctree["AttackTime"].ToTagShort(); _deathTime = ctree["DeathTime"].ToTagShort(); _health = ctree["Health"].ToTagShort(); _hurtTime = ctree["HurtTime"].ToTagShort(); if (ctree.ContainsKey("CanPickUpLoot")) { _canPickUpLoot = ctree["CanPickUpLoot"].ToTagByte(); } if (ctree.ContainsKey("PersistenceRequired")) { _persistenceRequired = ctree["PersistenceRequired"].ToTagByte(); } if (ctree.ContainsKey("CustomNameVisible")) { _customNameVisible = ctree["CustomNameVisible"].ToTagByte(); } if (ctree.ContainsKey("CustomName")) { _customName = ctree["CustomName"].ToTagString(); } if (ctree.ContainsKey("ActiveEffects")) { TagNodeList ae = ctree["ActiveEffects"].ToTagList(); _activeEffects = new List <ActiveEffects>(); foreach (TagNode tag in ae) { TagNodeCompound effectTag = tag.ToTagCompound(); ActiveEffects effect = new ActiveEffects(); effect.Id = effectTag["Id"].ToTagByte(); effect.Amplifier = effectTag["Amplifier"].ToTagByte(); effect.Duration = effectTag["Duration"].ToTagInt(); effect.Ambient = effectTag["Ambient"].ToTagByte() == 1; _activeEffects.Add(effect); } } if (ctree.ContainsKey("Equipment")) { TagNodeList eq = ctree["Equipment"].ToTagList(); for (int i = 0; i < 5 && i < eq.Count; i++) { _equipment[i] = new Item().LoadTree(eq[i]); } } if (ctree.ContainsKey("DropChances")) { TagNodeList dc = ctree["DropChances"].ToTagList(); for (int i = 0; i < 5 && i < dc.Count; i++) { _dropChances[i] = dc[i].ToTagFloat(); } } return(this); }