From a9c6ed9de907a491237d77e816ce59fb184c4bdf Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Thu, 15 Dec 2011 23:03:57 -0500 Subject: [PATCH] Fixed EntityMob writing out invalid ActiveEffects dictionary on mobs. --- SubstrateCS/Source/Entities/EntityMob.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/SubstrateCS/Source/Entities/EntityMob.cs b/SubstrateCS/Source/Entities/EntityMob.cs index 1cabc45..ee48ead 100644 --- a/SubstrateCS/Source/Entities/EntityMob.cs +++ b/SubstrateCS/Source/Entities/EntityMob.cs @@ -43,6 +43,17 @@ using Substrate.Core; set { _duration = value; } } + /// + /// Determine if the combination of properties in this ActiveEffects is valid. + /// + public bool IsValid + { + get + { + return !(_id == 0 || _amplifier == 0 || _duration == 0); + } + } + #region ICopyable Members public ActiveEffects Copy () @@ -179,7 +190,7 @@ using Substrate.Core; tree["Health"] = new TagNodeShort(_health); tree["HurtTime"] = new TagNodeShort(_hurtTime); - if (_activeEffects != null) { + if (_activeEffects != null && _activeEffects.IsValid) { TagNodeCompound ae = new TagNodeCompound(); ae["Id"] = new TagNodeByte((byte)_activeEffects.Id); ae["Amplifier"] = new TagNodeByte((byte)_activeEffects.Amplifier);