2011-04-06 22:01:22 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace Substrate.Entities
|
|
|
|
|
{
|
|
|
|
|
using Substrate.NBT;
|
|
|
|
|
|
|
|
|
|
public class EntityFallingSand : Entity
|
|
|
|
|
{
|
|
|
|
|
public static readonly NBTCompoundNode FallingSandSchema = BaseSchema.MergeInto(new NBTCompoundNode("")
|
|
|
|
|
{
|
|
|
|
|
new NBTStringNode("id", "FallingSand"),
|
2011-04-09 02:50:42 +00:00
|
|
|
|
new NBTScalerNode("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")
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public EntityFallingSand (Entity e)
|
|
|
|
|
: base(e)
|
|
|
|
|
{
|
|
|
|
|
EntityFallingSand e2 = e as EntityFallingSand;
|
|
|
|
|
if (e2 != null) {
|
|
|
|
|
_tile = e2._tile;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region INBTObject<Entity> Members
|
|
|
|
|
|
2011-04-09 02:50:42 +00:00
|
|
|
|
public override Entity LoadTree (TagValue tree)
|
2011-04-06 22:01:22 +00:00
|
|
|
|
{
|
2011-04-09 02:50:42 +00:00
|
|
|
|
TagCompound ctree = tree as TagCompound;
|
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-04-09 02:50:42 +00:00
|
|
|
|
public override TagValue BuildTree ()
|
2011-04-06 22:01:22 +00:00
|
|
|
|
{
|
2011-04-09 02:50:42 +00:00
|
|
|
|
TagCompound tree = base.BuildTree() as TagCompound;
|
|
|
|
|
tree["Tile"] = new TagByte(_tile);
|
2011-04-06 22:01:22 +00:00
|
|
|
|
|
|
|
|
|
return tree;
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-09 02:50:42 +00:00
|
|
|
|
public override bool ValidateTree (TagValue tree)
|
2011-04-06 22:01:22 +00:00
|
|
|
|
{
|
|
|
|
|
return new NBTVerifier(tree, FallingSandSchema).Verify();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region ICopyable<Entity> Members
|
|
|
|
|
|
|
|
|
|
public override Entity Copy ()
|
|
|
|
|
{
|
|
|
|
|
return new EntityFallingSand(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|