2011-04-06 22:01:22 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace Substrate.Entities
|
|
|
|
|
{
|
|
|
|
|
using Substrate.NBT;
|
|
|
|
|
|
2011-06-30 03:59:20 +00:00
|
|
|
|
public class EntityFallingSand : EntityTyped
|
2011-04-06 22:01:22 +00:00
|
|
|
|
{
|
2011-06-30 03:59:20 +00:00
|
|
|
|
public static readonly SchemaNodeCompound FallingSandSchema = EntityTyped.Schema.MergeInto(new SchemaNodeCompound("")
|
2011-04-06 22:01:22 +00:00
|
|
|
|
{
|
2011-06-20 03:51:40 +00:00
|
|
|
|
new SchemaNodeString("id", "FallingSand"),
|
|
|
|
|
new SchemaNodeScaler("Tile", TagType.TAG_BYTE),
|
2011-04-06 22:01:22 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
private byte _tile;
|
|
|
|
|
|
|
|
|
|
public int Tile
|
|
|
|
|
{
|
|
|
|
|
get { return _tile; }
|
|
|
|
|
set { _tile = (byte)value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public EntityFallingSand ()
|
|
|
|
|
: base("PrimedTnt")
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-30 03:59:20 +00:00
|
|
|
|
public EntityFallingSand (EntityTyped e)
|
2011-04-06 22:01:22 +00:00
|
|
|
|
: base(e)
|
|
|
|
|
{
|
|
|
|
|
EntityFallingSand e2 = e as EntityFallingSand;
|
|
|
|
|
if (e2 != null) {
|
|
|
|
|
_tile = e2._tile;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region INBTObject<Entity> Members
|
|
|
|
|
|
2011-06-30 03:59:20 +00:00
|
|
|
|
public override EntityTyped LoadTree (TagNode tree)
|
2011-04-06 22:01:22 +00:00
|
|
|
|
{
|
2011-06-20 03:51:40 +00:00
|
|
|
|
TagNodeCompound ctree = tree as TagNodeCompound;
|
2011-04-06 22:01:22 +00:00
|
|
|
|
if (ctree == null || base.LoadTree(tree) == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-09 02:50:42 +00:00
|
|
|
|
_tile = ctree["Tile"].ToTagByte();
|
2011-04-06 22:01:22 +00:00
|
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-20 03:51:40 +00:00
|
|
|
|
public override TagNode BuildTree ()
|
2011-04-06 22:01:22 +00:00
|
|
|
|
{
|
2011-06-20 03:51:40 +00:00
|
|
|
|
TagNodeCompound tree = base.BuildTree() as TagNodeCompound;
|
|
|
|
|
tree["Tile"] = new TagNodeByte(_tile);
|
2011-04-06 22:01:22 +00:00
|
|
|
|
|
|
|
|
|
return tree;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-20 03:51:40 +00:00
|
|
|
|
public override bool ValidateTree (TagNode tree)
|
2011-04-06 22:01:22 +00:00
|
|
|
|
{
|
|
|
|
|
return new NBTVerifier(tree, FallingSandSchema).Verify();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region ICopyable<Entity> Members
|
|
|
|
|
|
2011-06-30 03:59:20 +00:00
|
|
|
|
public override EntityTyped Copy ()
|
2011-04-06 22:01:22 +00:00
|
|
|
|
{
|
|
|
|
|
return new EntityFallingSand(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|