2011-06-05 04:11:44 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace Substrate.TileEntities
|
|
|
|
|
{
|
|
|
|
|
using Substrate.NBT;
|
|
|
|
|
|
|
|
|
|
public class TileEntityRecordPlayer : TileEntity
|
|
|
|
|
{
|
2011-06-20 03:51:40 +00:00
|
|
|
|
public static readonly SchemaNodeCompound RecordPlayerSchema = BaseSchema.MergeInto(new SchemaNodeCompound("")
|
2011-06-05 04:11:44 +00:00
|
|
|
|
{
|
2011-06-20 03:51:40 +00:00
|
|
|
|
new SchemaNodeString("id", "RecordPlayer"),
|
|
|
|
|
new SchemaNodeScaler("Record", TagType.TAG_INT, SchemaOptions.OPTIONAL),
|
2011-06-05 04:11:44 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
private int? _record = null;
|
|
|
|
|
|
|
|
|
|
public int? Record
|
|
|
|
|
{
|
|
|
|
|
get { return _record; }
|
|
|
|
|
set { _record = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TileEntityRecordPlayer ()
|
|
|
|
|
: base("RecordPlayer")
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TileEntityRecordPlayer (TileEntity te)
|
|
|
|
|
: base(te)
|
|
|
|
|
{
|
|
|
|
|
TileEntityRecordPlayer tes = te as TileEntityRecordPlayer;
|
|
|
|
|
if (tes != null) {
|
|
|
|
|
_record = tes._record;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region ICopyable<TileEntity> Members
|
|
|
|
|
|
|
|
|
|
public override TileEntity Copy ()
|
|
|
|
|
{
|
|
|
|
|
return new TileEntityRecordPlayer(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region INBTObject<TileEntity> Members
|
|
|
|
|
|
2011-06-20 03:51:40 +00:00
|
|
|
|
public override TileEntity LoadTree (TagNode tree)
|
2011-06-05 04:11:44 +00:00
|
|
|
|
{
|
2011-06-20 03:51:40 +00:00
|
|
|
|
TagNodeCompound ctree = tree as TagNodeCompound;
|
2011-06-05 04:11:44 +00:00
|
|
|
|
if (ctree == null || base.LoadTree(tree) == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ctree.ContainsKey("Record")) {
|
|
|
|
|
_record = ctree["Record"].ToTagInt();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-20 03:51:40 +00:00
|
|
|
|
public override TagNode BuildTree ()
|
2011-06-05 04:11:44 +00:00
|
|
|
|
{
|
2011-06-20 03:51:40 +00:00
|
|
|
|
TagNodeCompound tree = base.BuildTree() as TagNodeCompound;
|
2011-06-05 04:11:44 +00:00
|
|
|
|
|
|
|
|
|
if (_record != null) {
|
2011-06-20 03:51:40 +00:00
|
|
|
|
tree["Record"] = new TagNodeInt((int)_record);
|
2011-06-05 04:11:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return tree;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-20 03:51:40 +00:00
|
|
|
|
public override bool ValidateTree (TagNode tree)
|
2011-06-05 04:11:44 +00:00
|
|
|
|
{
|
|
|
|
|
return new NBTVerifier(tree, RecordPlayerSchema).Verify();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|