2011-04-06 19:41:57 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
2011-04-06 21:20:35 +00:00
|
|
|
|
namespace Substrate.Entities
|
2011-04-06 19:41:57 +00:00
|
|
|
|
{
|
2011-06-30 04:41:29 +00:00
|
|
|
|
using Substrate.Nbt;
|
2011-04-06 19:41:57 +00:00
|
|
|
|
|
|
|
|
|
public class EntitySlime : EntityMob
|
|
|
|
|
{
|
2011-06-20 03:51:40 +00:00
|
|
|
|
public static readonly SchemaNodeCompound SlimeSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
|
2011-04-06 19:41:57 +00:00
|
|
|
|
{
|
2011-06-20 03:51:40 +00:00
|
|
|
|
new SchemaNodeString("id", "Slime"),
|
|
|
|
|
new SchemaNodeScaler("Size", TagType.TAG_INT),
|
2011-04-06 19:41:57 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
private int _size;
|
|
|
|
|
|
|
|
|
|
public int Size
|
|
|
|
|
{
|
|
|
|
|
get { return _size; }
|
|
|
|
|
set { _size = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public EntitySlime ()
|
|
|
|
|
: base("Slime")
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-30 03:59:20 +00:00
|
|
|
|
public EntitySlime (EntityTyped e)
|
2011-04-06 19:41:57 +00:00
|
|
|
|
: base(e)
|
|
|
|
|
{
|
|
|
|
|
EntitySlime e2 = e as EntitySlime;
|
|
|
|
|
if (e2 != null) {
|
|
|
|
|
_size = e2._size;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region INBTObject<Entity> Members
|
|
|
|
|
|
2011-06-30 03:59:20 +00:00
|
|
|
|
public override EntityTyped LoadTree (TagNode tree)
|
2011-04-06 19:41:57 +00:00
|
|
|
|
{
|
2011-06-20 03:51:40 +00:00
|
|
|
|
TagNodeCompound ctree = tree as TagNodeCompound;
|
2011-04-06 19:41:57 +00:00
|
|
|
|
if (ctree == null || base.LoadTree(tree) == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-09 02:50:42 +00:00
|
|
|
|
_size = ctree["Size"].ToTagInt();
|
2011-04-06 19:41:57 +00:00
|
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-20 03:51:40 +00:00
|
|
|
|
public override TagNode BuildTree ()
|
2011-04-06 19:41:57 +00:00
|
|
|
|
{
|
2011-06-20 03:51:40 +00:00
|
|
|
|
TagNodeCompound tree = base.BuildTree() as TagNodeCompound;
|
|
|
|
|
tree["Size"] = new TagNodeInt(_size);
|
2011-04-06 19:41:57 +00:00
|
|
|
|
|
|
|
|
|
return tree;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-20 03:51:40 +00:00
|
|
|
|
public override bool ValidateTree (TagNode tree)
|
2011-04-06 19:41:57 +00:00
|
|
|
|
{
|
2011-06-30 04:57:18 +00:00
|
|
|
|
return new NbtVerifier(tree, SlimeSchema).Verify();
|
2011-04-06 19:41:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region ICopyable<Entity> Members
|
|
|
|
|
|
2011-06-30 03:59:20 +00:00
|
|
|
|
public override EntityTyped Copy ()
|
2011-04-06 19:41:57 +00:00
|
|
|
|
{
|
|
|
|
|
return new EntitySlime(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|