Fixed EntityMob writing out invalid ActiveEffects dictionary on mobs.

This commit is contained in:
Justin Aquadro 2011-12-15 23:03:57 -05:00
parent e2e558b8be
commit a9c6ed9de9

View file

@ -43,6 +43,17 @@ using Substrate.Core;
set { _duration = value; } set { _duration = value; }
} }
/// <summary>
/// Determine if the combination of properties in this ActiveEffects is valid.
/// </summary>
public bool IsValid
{
get
{
return !(_id == 0 || _amplifier == 0 || _duration == 0);
}
}
#region ICopyable<ActiveEffects> Members #region ICopyable<ActiveEffects> Members
public ActiveEffects Copy () public ActiveEffects Copy ()
@ -179,7 +190,7 @@ using Substrate.Core;
tree["Health"] = new TagNodeShort(_health); tree["Health"] = new TagNodeShort(_health);
tree["HurtTime"] = new TagNodeShort(_hurtTime); tree["HurtTime"] = new TagNodeShort(_hurtTime);
if (_activeEffects != null) { if (_activeEffects != null && _activeEffects.IsValid) {
TagNodeCompound ae = new TagNodeCompound(); TagNodeCompound ae = new TagNodeCompound();
ae["Id"] = new TagNodeByte((byte)_activeEffects.Id); ae["Id"] = new TagNodeByte((byte)_activeEffects.Id);
ae["Amplifier"] = new TagNodeByte((byte)_activeEffects.Amplifier); ae["Amplifier"] = new TagNodeByte((byte)_activeEffects.Amplifier);