diff --git a/Substrate/SubstrateCS/Source/AlphaBlock.cs b/Substrate/SubstrateCS/Source/AlphaBlock.cs
new file mode 100644
index 0000000..6d2772f
--- /dev/null
+++ b/Substrate/SubstrateCS/Source/AlphaBlock.cs
@@ -0,0 +1,188 @@
+using System;
+using Substrate.Core;
+
+namespace Substrate
+{
+ ///
+ /// A single Alpha-compatible block with context-independent data.
+ ///
+ /// In general, you should prefer other types for accessing block data including ,
+ /// , and the property of and.
+ /// You should use the type when you need to copy individual blocks into a custom collection or
+ /// container, and context-depdendent data such as coordinates and lighting have no well-defined meaning.
+ /// offers a relatively compact footprint for storing the unique identity of a block's manifestation in the world.
+ /// A single object may also provide a convenient way to paste a block into many locations in
+ /// a block collection type.
+ public class AlphaBlock : IDataBlock, IPropertyBlock, ICopyable
+ {
+ private int _id;
+ private int _data;
+
+ private TileEntity _tileEntity;
+
+ ///
+ /// Create a new instance of the given type with default data.
+ ///
+ /// The id (type) of the block.
+ /// If the specified block type requires a Tile Entity as part of its definition, a default
+ /// of the appropriate type will automatically be created.
+ public AlphaBlock (int id)
+ {
+ _id = id;
+ UpdateTileEntity(0, id);
+ }
+
+ ///
+ /// Create a new instance of the given type and data value.
+ ///
+ /// The id (type) of the block.
+ /// The block's supplementary data value, currently limited to the range [0-15].
+ /// If the specified block type requires a Tile Entity as part of its definition, a default
+ /// of the appropriate type will automatically be created.
+ public AlphaBlock (int id, int data)
+ {
+ _id = id;
+ _data = data;
+ UpdateTileEntity(0, id);
+ }
+
+ ///
+ /// Crrates a new from a given block in an existing .
+ ///
+ /// The block collection to reference.
+ /// The local X-coordinate of a block within the collection.
+ /// The local Y-coordinate of a block within the collection.
+ /// The local Z-coordinate of a block within the collection.
+ public AlphaBlock (IAlphaBlockCollection chunk, int lx, int ly, int lz)
+ {
+ _id = chunk.GetID(lx, ly, lz);
+ _data = chunk.GetData(lx, ly, lz);
+ _tileEntity = chunk.GetTileEntity(lx, ly, lz).Copy();
+ }
+
+
+ #region IBlock Members
+
+ ///
+ /// Gets information on the type of the block.
+ ///
+ public BlockInfo Info
+ {
+ get { return BlockInfo.BlockTable[_id]; }
+ }
+
+ ///
+ /// Gets or sets the id (type) of the block.
+ ///
+ /// If the new or old type have non-matching Tile Entity requirements, the embedded Tile Entity data
+ /// will be updated to keep consistent with the new block type.
+ public int ID
+ {
+ get { return _id; }
+ set
+ {
+ UpdateTileEntity(_id, value);
+ _id = value;
+ }
+ }
+
+ #endregion
+
+
+ #region IDataBlock Members
+
+ ///
+ /// Gets or sets the supplementary data value of the block.
+ ///
+ public int Data
+ {
+ get { return _data; }
+ set
+ {
+ /*if (BlockManager.EnforceDataLimits && BlockInfo.BlockTable[_id] != null) {
+ if (!BlockInfo.BlockTable[_id].TestData(value)) {
+ return;
+ }
+ }*/
+ _data = value;
+ }
+ }
+
+ #endregion
+
+
+ #region IPropertyBlock Members
+
+ ///
+ /// Gets the Tile Entity record of the block if it has one.
+ ///
+ /// The attached to this block, or null if the block type does not require a Tile Entity.
+ public TileEntity GetTileEntity ()
+ {
+ return _tileEntity;
+ }
+
+ ///
+ /// Sets a new Tile Entity record for the block.
+ ///
+ /// A Tile Entity record compatible with the block's type.
+ /// Thrown when an incompatible is added to a block.
+ /// Thrown when a is added to a block that does not use tile entities.
+ public void SetTileEntity (TileEntity te)
+ {
+ BlockInfoEx info = BlockInfo.BlockTable[_id] as BlockInfoEx;
+ if (info == null) {
+ throw new InvalidOperationException("The current block type does not accept a Tile Entity");
+ }
+
+ if (te.GetType() != TileEntityFactory.Lookup(info.TileEntityName)) {
+ throw new ArgumentException("The current block type is not compatible with the given Tile Entity", "te");
+ }
+
+ _tileEntity = te;
+ }
+
+ ///
+ /// Removes any Tile Entity currently attached to the block.
+ ///
+ public void ClearTileEntity ()
+ {
+ _tileEntity = null;
+ }
+
+ #endregion
+
+
+ #region ICopyable Members
+
+ ///
+ /// Creates a deep copy of the .
+ ///
+ /// A new representing the same data.
+ public AlphaBlock Copy ()
+ {
+ AlphaBlock block = new AlphaBlock(_id, _data);
+ block._tileEntity = _tileEntity.Copy();
+
+ return block;
+ }
+
+ #endregion
+
+ private void UpdateTileEntity (int old, int value)
+ {
+ BlockInfoEx info1 = BlockInfo.BlockTable[old] as BlockInfoEx;
+ BlockInfoEx info2 = BlockInfo.BlockTable[value] as BlockInfoEx;
+
+ if (info1 != info2) {
+ if (info1 != null) {
+ _tileEntity = null;
+ }
+
+ if (info2 != null) {
+ _tileEntity = TileEntityFactory.Create(info2.TileEntityName);
+ }
+ }
+ }
+ }
+}
diff --git a/Substrate/SubstrateCS/Source/AlphaBlockCollection.cs b/Substrate/SubstrateCS/Source/AlphaBlockCollection.cs
index 8735e08..5c58fcb 100644
--- a/Substrate/SubstrateCS/Source/AlphaBlockCollection.cs
+++ b/Substrate/SubstrateCS/Source/AlphaBlockCollection.cs
@@ -128,42 +128,42 @@ namespace Substrate
}
///
- /// Returns a new object from local coordinates relative to this collection.
+ /// Returns a new object from local coordinates relative to this collection.
///
/// Local X-coordinate of block.
/// Local Y-coordinate of block.
/// Local Z-coordiante of block.
- /// A new object representing context-independent data of a single block.
- /// Context-independent data excludes data such as lighting. object actually contain a copy
- /// of the data they represent, so changes to the will not affect this container, and vice-versa.
- public Block GetBlock (int x, int y, int z)
+ /// A new object representing context-independent data of a single block.
+ /// Context-independent data excludes data such as lighting. object actually contain a copy
+ /// of the data they represent, so changes to the will not affect this container, and vice-versa.
+ public AlphaBlock GetBlock (int x, int y, int z)
{
- return new Block(this, x, y, z);
+ return new AlphaBlock(this, x, y, z);
}
///
- /// Returns a new object from local coordaintes relative to this collection.
+ /// Returns a new object from local coordaintes relative to this collection.
///
/// Local X-coordinate of block.
/// Local Y-coordinate of block.
/// Local Z-coordinate of block.
- /// A new object representing context-dependent data of a single block.
- /// Context-depdendent data includes all data associated with this block. Since a represents
- /// a view of a block within this container, any updates to data in the container will be reflected in the ,
- /// and vice-versa for updates to the .
- public BlockRef GetBlockRef (int x, int y, int z)
+ /// A new object representing context-dependent data of a single block.
+ /// Context-depdendent data includes all data associated with this block. Since a represents
+ /// a view of a block within this container, any updates to data in the container will be reflected in the ,
+ /// and vice-versa for updates to the .
+ public AlphaBlockRef GetBlockRef (int x, int y, int z)
{
- return new BlockRef(this, x, y, z);
+ return new AlphaBlockRef(this, _blocks.GetIndex(x, y, z));
}
///
- /// Updates a block in this collection with values from a object.
+ /// Updates a block in this collection with values from a object.
///
/// Local X-coordinate of a block.
/// Local Y-coordinate of a block.
/// Local Z-coordinate of a block.
- /// A object to copy block data from.
- public void SetBlock (int x, int y, int z, Block block)
+ /// A object to copy block data from.
+ public void SetBlock (int x, int y, int z, AlphaBlock block)
{
SetID(x, y, z, block.ID);
SetData(x, y, z, block.Data);
@@ -204,7 +204,7 @@ namespace Substrate
/// Local Y-coordinate of a block.
/// Local Z-coordinate of a block.
/// An -compatible object.
- ///
+ ///
IBlock IBlockCollection.GetBlock (int x, int y, int z)
{
return GetBlock(x, y, z);
@@ -217,7 +217,7 @@ namespace Substrate
/// Local Y-coordinate of a block.
/// Local Z-coordinate of a block.
/// An -compatible reference object.
- ///
+ ///
IBlock IBlockCollection.GetBlockRef (int x, int y, int z)
{
return GetBlockRef(x, y, z);
@@ -339,13 +339,8 @@ namespace Substrate
internal void SetID (int index, int id)
{
- int yzdim = _ydim * _zdim;
-
- int x = index / yzdim;
- int zy = index - (x * yzdim);
-
- int z = zy / _ydim;
- int y = zy - (z * _ydim);
+ int x, y, z;
+ _blocks.GetMultiIndex(index, out x, out y, out z);
SetID(x, y, z, id);
}
@@ -379,7 +374,7 @@ namespace Substrate
/// Local Y-coordinate of a block.
/// Local Z-coordinate of a block.
/// An -compatible object.
- ///
+ ///
IDataBlock IDataBlockCollection.GetBlock (int x, int y, int z)
{
return GetBlock(x, y, z);
@@ -392,7 +387,7 @@ namespace Substrate
/// Local Y-coordinate of a block.
/// Local Z-coordinate of a block.
/// An -compatible reference object.
- ///
+ ///
IDataBlock IDataBlockCollection.GetBlockRef (int x, int y, int z)
{
return GetBlockRef(x, y, z);
@@ -487,7 +482,7 @@ namespace Substrate
/// Local Y-coordinate of a block.
/// Local Z-coordinate of a block.
/// An -compatible object.
- ///
+ ///
ILitBlock ILitBlockCollection.GetBlock (int x, int y, int z)
{
throw new NotImplementedException();
@@ -500,7 +495,7 @@ namespace Substrate
/// Local Y-coordinate of a block.
/// Local Z-coordinate of a block.
/// An -compatible reference object.
- ///
+ ///
ILitBlock ILitBlockCollection.GetBlockRef (int x, int y, int z)
{
return GetBlockRef(x, y, z);
@@ -785,7 +780,7 @@ namespace Substrate
/// Local Y-coordinate of a block.
/// Local Z-coordinate of a block.
/// An -compatible object.
- ///
+ ///
IPropertyBlock IPropertyBlockCollection.GetBlock (int x, int y, int z)
{
return GetBlock(x, y, z);
@@ -798,7 +793,7 @@ namespace Substrate
/// Local Y-coordinate of a block.
/// Local Z-coordinate of a block.
/// An -compatible reference object.
- ///
+ ///
IPropertyBlock IPropertyBlockCollection.GetBlockRef (int x, int y, int z)
{
return GetBlockRef(x, y, z);
@@ -829,6 +824,14 @@ namespace Substrate
return _tileEntityManager.GetTileEntity(x, y, z);
}
+ internal TileEntity GetTileEntity (int index)
+ {
+ int x, y, z;
+ _blocks.GetMultiIndex(index, out x, out y, out z);
+
+ return _tileEntityManager.GetTileEntity(x, y, z);
+ }
+
///
/// Sets a record for a block at the given local coordinates.
///
@@ -844,6 +847,15 @@ namespace Substrate
_dirty = true;
}
+ internal void SetTileEntity (int index, TileEntity te)
+ {
+ int x, y, z;
+ _blocks.GetMultiIndex(index, out x, out y, out z);
+
+ _tileEntityManager.SetTileEntity(x, y, z, te);
+ _dirty = true;
+ }
+
///
/// Creates a default record suitable for the block at the given local coordinates.
///
@@ -858,6 +870,15 @@ namespace Substrate
_dirty = true;
}
+ internal void CreateTileEntity (int index)
+ {
+ int x, y, z;
+ _blocks.GetMultiIndex(index, out x, out y, out z);
+
+ _tileEntityManager.CreateTileEntity(x, y, z);
+ _dirty = true;
+ }
+
///
/// Clears any record set for a block at the givne local coordinates, if one exists.
///
@@ -870,6 +891,15 @@ namespace Substrate
_dirty = true;
}
+ internal void ClearTileEntity (int index)
+ {
+ int x, y, z;
+ _blocks.GetMultiIndex(index, out x, out y, out z);
+
+ _tileEntityManager.ClearTileEntity(x, y, z);
+ _dirty = true;
+ }
+
#endregion
public void ResetFluid ()
diff --git a/Substrate/SubstrateCS/Source/AlphaBlockRef.cs b/Substrate/SubstrateCS/Source/AlphaBlockRef.cs
new file mode 100644
index 0000000..6a9b89d
--- /dev/null
+++ b/Substrate/SubstrateCS/Source/AlphaBlockRef.cs
@@ -0,0 +1,153 @@
+using System;
+using Substrate.Core;
+
+//TODO: Benchmark struct vs. class. If no difference, prefer class.
+
+namespace Substrate
+{
+ ///
+ /// A reference to a single Alpha-compatible block in an .
+ ///
+ /// The type provides a reasonably lightweight reference to an individual block in a
+ /// . The does not store any of the data itself. If the referenced
+ /// block in the is updated externally, those changes will be automatically reflected in the
+ /// , and any changes made via the will be applied directly to the corresponding
+ /// block within the . Such changes will also set the dirty status of the ,
+ /// which can make this type particularly useful.
+ /// Despite being lightweight, using an to get and set block data is still more expensive then directly
+ /// getting and setting data in the object, and can be significantly slow in a tight loop
+ /// ( does not provide an interface for enumerating objects specifically
+ /// to discourage this kind of use).
+ /// objects are most appropriate in cases where looking up an object requires expensive checks, such as
+ /// accessing blocks through a derived type with enhanced block filtering. By getting an ,
+ /// any number of block attributes can be read or written to while only paying the lookup cost once to get the reference. Using the
+ /// (or similar) directly would incur the expensive lookup on each operation. See NBToolkit for an example of this
+ /// use case.
+ /// Unlike the object, this type exposed access to context-dependent data such as lighting.
+ public struct AlphaBlockRef : IAlphaBlockRef
+ {
+ private readonly AlphaBlockCollection _collection;
+ private readonly int _index;
+
+ internal AlphaBlockRef (AlphaBlockCollection collection, int index)
+ {
+ _collection = collection;
+ _index = index;
+ }
+
+ public bool IsValid
+ {
+ get { return _collection != null; }
+ }
+
+ #region IBlock Members
+
+ ///
+ /// Gets information on the type of the block.
+ ///
+ public BlockInfo Info
+ {
+ get { return _collection.GetInfo(_index); }
+ }
+
+ ///
+ /// Gets or sets the id (type) of the block.
+ ///
+ public int ID
+ {
+ get
+ {
+ return _collection.GetID(_index);
+ }
+ set
+ {
+ _collection.SetID(_index, value);
+ }
+ }
+
+ #endregion
+
+ #region IDataBlock Members
+
+ ///
+ /// Gets or sets the supplementary data value of the block.
+ ///
+ public int Data
+ {
+ get
+ {
+ return _collection.GetData(_index);
+ }
+ set
+ {
+ _collection.SetData(_index, value);
+ }
+ }
+
+ #endregion
+
+ #region ILitBlock Members
+
+ ///
+ /// Gets or sets the block-source light component of the block.
+ ///
+ public int BlockLight
+ {
+ get
+ {
+ return _collection.GetBlockLight(_index);
+ }
+ set
+ {
+ _collection.SetBlockLight(_index, value);
+ }
+ }
+
+ ///
+ /// Gets or sets the sky-source light component of the block.
+ ///
+ public int SkyLight
+ {
+ get
+ {
+ return _collection.GetSkyLight(_index);
+ }
+ set
+ {
+ _collection.SetSkyLight(_index, value);
+ }
+ }
+
+ #endregion
+
+ #region IPropertyBlock Members
+
+ ///
+ /// Gets the Tile Entity record of the block if it has one.
+ ///
+ /// The attached to this block, or null if the block type does not require a Tile Entity.
+ public TileEntity GetTileEntity ()
+ {
+ return _collection.GetTileEntity(_index);
+ }
+
+ ///
+ /// Sets a new Tile Entity record for the block.
+ ///
+ /// A Tile Entity record compatible with the block's type.
+ public void SetTileEntity (TileEntity te)
+ {
+ _collection.SetTileEntity(_index, te);
+ }
+
+ ///
+ /// Removes any Tile Entity currently attached to the block.
+ ///
+ public void ClearTileEntity ()
+ {
+ _collection.ClearTileEntity(_index);
+ }
+
+ #endregion
+ }
+}
diff --git a/Substrate/SubstrateCS/Source/Block.cs b/Substrate/SubstrateCS/Source/Block.cs
deleted file mode 100644
index ec863ae..0000000
--- a/Substrate/SubstrateCS/Source/Block.cs
+++ /dev/null
@@ -1,131 +0,0 @@
-using System;
-using Substrate.Core;
-using Substrate.NBT;
-
-namespace Substrate
-{
- public class Block : IDataBlock, IPropertyBlock, ICopyable
- {
- private int _id;
- private int _data;
-
- private TileEntity _tileEntity;
-
- public Block (int id)
- {
- _id = id;
- UpdateTileEntity(0, id);
- }
-
- public Block (int id, int data)
- {
- _id = id;
- _data = data;
- UpdateTileEntity(0, id);
- }
-
- public Block (IAlphaBlockCollection chunk, int lx, int ly, int lz)
- {
- _id = chunk.GetID(lx, ly, lz);
- _data = chunk.GetData(lx, ly, lz);
- _tileEntity = chunk.GetTileEntity(lx, ly, lz).Copy();
- }
-
-
- #region IBlock Members
-
- public BlockInfo Info
- {
- get { return BlockInfo.BlockTable[_id]; }
- }
-
- public int ID
- {
- get { return _id; }
- set
- {
- UpdateTileEntity(_id, value);
- _id = value;
- }
- }
-
- #endregion
-
-
- #region IDataBlock Members
-
- public int Data
- {
- get { return _data; }
- set
- {
- /*if (BlockManager.EnforceDataLimits && BlockInfo.BlockTable[_id] != null) {
- if (!BlockInfo.BlockTable[_id].TestData(value)) {
- return;
- }
- }*/
- _data = value;
- }
- }
-
- #endregion
-
-
- #region IPropertyBlock Members
-
- public TileEntity GetTileEntity ()
- {
- return _tileEntity;
- }
-
- public void SetTileEntity (TileEntity te)
- {
- BlockInfoEx info = BlockInfo.BlockTable[_id] as BlockInfoEx;
- if (info == null) {
- return;
- }
-
- if (te.GetType() != TileEntityFactory.Lookup(info.TileEntityName)) {
- return;
- }
-
- _tileEntity = te;
- }
-
- public void ClearTileEntity ()
- {
- _tileEntity = null;
- }
-
- #endregion
-
-
- #region ICopyable Members
-
- public Block Copy ()
- {
- Block block = new Block(_id, _data);
- block._tileEntity = _tileEntity.Copy();
-
- return block;
- }
-
- #endregion
-
- private void UpdateTileEntity (int old, int value)
- {
- BlockInfoEx info1 = BlockInfo.BlockTable[old] as BlockInfoEx;
- BlockInfoEx info2 = BlockInfo.BlockTable[value] as BlockInfoEx;
-
- if (info1 != info2) {
- if (info1 != null) {
- _tileEntity = null;
- }
-
- if (info2 != null) {
- _tileEntity = TileEntityFactory.Create(info2.TileEntityName);
- }
- }
- }
- }
-}
diff --git a/Substrate/SubstrateCS/Source/BlockManager.cs b/Substrate/SubstrateCS/Source/BlockManager.cs
index cc393f6..479c570 100644
--- a/Substrate/SubstrateCS/Source/BlockManager.cs
+++ b/Substrate/SubstrateCS/Source/BlockManager.cs
@@ -58,7 +58,7 @@ namespace Substrate
_chunkZLog = Log2(_chunkZDim);
}
- public Block GetBlock (int x, int y, int z)
+ public AlphaBlock GetBlock (int x, int y, int z)
{
_cache = GetChunk(x, y, z);
if (_cache == null || !Check(x, y, z)) {
@@ -68,17 +68,17 @@ namespace Substrate
return _cache.Blocks.GetBlock(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask);
}
- public BlockRef GetBlockRef (int x, int y, int z)
+ public AlphaBlockRef GetBlockRef (int x, int y, int z)
{
_cache = GetChunk(x, y, z);
if (_cache == null || !Check(x, y, z)) {
- return null;
+ return new AlphaBlockRef();
}
return _cache.Blocks.GetBlockRef(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask);
}
- public void SetBlock (int x, int y, int z, Block block)
+ public void SetBlock (int x, int y, int z, AlphaBlock block)
{
_cache = GetChunk(x, y, z);
if (_cache == null || !Check(x, y, z)) {
diff --git a/Substrate/SubstrateCS/Source/BlockRef.cs b/Substrate/SubstrateCS/Source/BlockRef.cs
deleted file mode 100644
index 99d82d5..0000000
--- a/Substrate/SubstrateCS/Source/BlockRef.cs
+++ /dev/null
@@ -1,213 +0,0 @@
-using System;
-using Substrate.Core;
-
-namespace Substrate
-{
- public class BlockRef : IDataBlock, IPropertyBlock, ILitBlock
- {
- protected IAlphaBlockCollection _container;
-
- protected int _x;
- protected int _y;
- protected int _z;
-
- /*public int X
- {
- get { return _container.BlockGlobalX(_x); }
- }
-
- public int Y
- {
- get { return _container.BlockGlobalY(_y); }
- }
-
- public int Z
- {
- get { return _container.BlockGlobalZ(_z); }
- }
-
- public int LocalX
- {
- get { return _container.BlockLocalX(_x); }
- }
-
- public int LocalY
- {
- get { return _container.BlockLocalZ(_z); }
- }
-
- public int LocalZ
- {
- get { return _z; }
- }*/
-
-
- public BlockRef (IAlphaBlockCollection container, int x, int y, int z)
- {
- _container = container;
- _x = x;
- _y = y;
- _z = z;
- }
-
-
- #region IBlock Members
-
- public BlockInfo Info
- {
- get { return BlockInfo.BlockTable[_container.GetID(_x, _y, _z)]; }
- }
-
- public int ID
- {
- get { return _container.GetID(_x, _y, _z); }
- set { _container.SetID(_x, _y, _z, value); }
- }
-
- public int Data
- {
- get { return _container.GetData(_x, _y, _z); }
- set { _container.SetData(_x, _y, _z, value); }
- }
-
- #endregion
-
-
- #region ILitBlock Members
-
- public int BlockLight
- {
- get { return _container.GetBlockLight(_x, _y, _z); }
- set { _container.SetBlockLight(_x, _y, _z, value); }
- }
-
- public int SkyLight
- {
- get { return _container.GetSkyLight(_x, _y, _z); }
- set { _container.SetSkyLight(_x, _y, _z, value); }
- }
-
- #endregion
-
-
- #region IPropertyBlock Members
-
- public TileEntity GetTileEntity ()
- {
- return _container.GetTileEntity(_x, _y, _z);
- }
-
- public void SetTileEntity (TileEntity te)
- {
- _container.SetTileEntity(_x, _y, _z, te);
- }
-
- public void ClearTileEntity ()
- {
- _container.ClearTileEntity(_x, _y, _z);
- }
-
- #endregion
- }
-
- public struct AlphaBlockRef : IAlphaBlockRef
- {
- private readonly AlphaBlockCollection _collection;
- private readonly int _index;
-
- internal AlphaBlockRef (AlphaBlockCollection collection, int index)
- {
- _collection = collection;
- _index = index;
- }
-
- #region IBlock Members
-
- public BlockInfo Info
- {
- get { return _collection.GetInfo(_index); }
- }
-
- public int ID
- {
- get
- {
- return _collection.GetID(_index);
- }
- set
- {
- throw new NotImplementedException();
- }
- }
-
- #endregion
-
- #region IDataBlock Members
-
- public int Data
- {
- get
- {
- return _collection.GetData(_index);
- }
- set
- {
- _collection.SetData(_index, value);
- }
- }
-
- public void SetData (int value)
- {
- _collection.SetData(_index, value);
- }
-
- #endregion
-
- #region ILitBlock Members
-
- public int BlockLight
- {
- get
- {
- return _collection.GetBlockLight(_index);
- }
- set
- {
- _collection.SetBlockLight(_index, value);
- }
- }
-
- public int SkyLight
- {
- get
- {
- return _collection.GetSkyLight(_index);
- }
- set
- {
- _collection.SetSkyLight(_index, value);
- }
- }
-
- #endregion
-
- #region IPropertyBlock Members
-
- public TileEntity GetTileEntity ()
- {
- throw new NotImplementedException();
- }
-
- public void SetTileEntity (TileEntity te)
- {
- throw new NotImplementedException();
- }
-
- public void ClearTileEntity ()
- {
- throw new NotImplementedException();
- }
-
- #endregion
- }
-}
diff --git a/Substrate/SubstrateCS/Source/Core/BlockInterface.cs b/Substrate/SubstrateCS/Source/Core/BlockInterface.cs
index 756dd27..9b803e3 100644
--- a/Substrate/SubstrateCS/Source/Core/BlockInterface.cs
+++ b/Substrate/SubstrateCS/Source/Core/BlockInterface.cs
@@ -40,6 +40,7 @@ namespace Substrate.Core
public interface IAlphaBlockRef : IDataBlock, ILitBlock, IPropertyBlock
{
+ bool IsValid { get; }
}
public interface IBlockCollection
@@ -141,10 +142,10 @@ namespace Substrate.Core
public interface IAlphaBlockCollection : IDataBlockCollection, ILitBlockCollection, IPropertyBlockCollection
{
- new Block GetBlock (int x, int y, int z);
- new BlockRef GetBlockRef (int x, int y, int z);
+ new AlphaBlock GetBlock (int x, int y, int z);
+ new AlphaBlockRef GetBlockRef (int x, int y, int z);
- void SetBlock (int x, int y, int z, Block block);
+ void SetBlock (int x, int y, int z, AlphaBlock block);
}
public interface IBoundedAlphaBlockCollection : IAlphaBlockCollection, IBoundedDataBlockCollection, IBoundedLitBlockCollection, IBoundedPropertyBlockCollection
diff --git a/Substrate/SubstrateCS/Source/Core/ByteArray.cs b/Substrate/SubstrateCS/Source/Core/ByteArray.cs
index 48f4217..6112335 100644
--- a/Substrate/SubstrateCS/Source/Core/ByteArray.cs
+++ b/Substrate/SubstrateCS/Source/Core/ByteArray.cs
@@ -94,6 +94,21 @@ namespace Substrate.Core
get { return _zdim; }
}
+ public int GetIndex (int x, int y, int z)
+ {
+ return _ydim * (x * _zdim + z) + y;
+ }
+
+ public void GetMultiIndex (int index, out int x, out int y, out int z)
+ {
+ int yzdim = _ydim * _zdim;
+ x = index / yzdim;
+
+ int zy = index - (x * yzdim);
+ z = zy / _ydim;
+ y = zy - (z * _ydim);
+ }
+
#region ICopyable Members
public override ByteArray Copy ()
diff --git a/Substrate/SubstrateCS/Source/Core/ChunkKey.cs b/Substrate/SubstrateCS/Source/Core/ChunkKey.cs
index 4d0e5d2..d617a5c 100644
--- a/Substrate/SubstrateCS/Source/Core/ChunkKey.cs
+++ b/Substrate/SubstrateCS/Source/Core/ChunkKey.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;
-namespace Substrate
+namespace Substrate.Core
{
public struct ChunkKey : IEquatable
{
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityArrow.cs b/Substrate/SubstrateCS/Source/Entities/EntityArrow.cs
index 73f7a9b..ad0a705 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityArrow.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityArrow.cs
@@ -18,7 +18,7 @@ namespace Substrate.Entities
{
}
- public EntityArrow (Entity e)
+ public EntityArrow (EntityTyped e)
: base(e)
{
}
@@ -36,7 +36,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityArrow(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityBoat.cs b/Substrate/SubstrateCS/Source/Entities/EntityBoat.cs
index 483b5e1..c0f8a59 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityBoat.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityBoat.cs
@@ -6,9 +6,9 @@ namespace Substrate.Entities
{
using Substrate.NBT;
- public class EntityBoat : Entity
+ public class EntityBoat : EntityTyped
{
- public static readonly SchemaNodeCompound BoatSchema = BaseSchema.MergeInto(new SchemaNodeCompound("")
+ public static readonly SchemaNodeCompound BoatSchema = EntityTyped.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Boat"),
});
@@ -18,7 +18,7 @@ namespace Substrate.Entities
{
}
- public EntityBoat (Entity e)
+ public EntityBoat (EntityTyped e)
: base(e)
{
}
@@ -36,7 +36,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityBoat(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityChicken.cs b/Substrate/SubstrateCS/Source/Entities/EntityChicken.cs
index 6185159..a1fc143 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityChicken.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityChicken.cs
@@ -18,7 +18,7 @@ namespace Substrate.Entities
{
}
- public EntityChicken (Entity e)
+ public EntityChicken (EntityTyped e)
: base(e)
{
}
@@ -36,7 +36,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityChicken(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityCow.cs b/Substrate/SubstrateCS/Source/Entities/EntityCow.cs
index 2170ea3..132858f 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityCow.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityCow.cs
@@ -18,7 +18,7 @@ namespace Substrate.Entities
{
}
- public EntityCow (Entity e)
+ public EntityCow (EntityTyped e)
: base(e)
{
}
@@ -36,7 +36,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityCow(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityCreeper.cs b/Substrate/SubstrateCS/Source/Entities/EntityCreeper.cs
index 50d3fbf..ae54098 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityCreeper.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityCreeper.cs
@@ -18,7 +18,7 @@ namespace Substrate.Entities
{
}
- public EntityCreeper (Entity e)
+ public EntityCreeper (EntityTyped e)
: base(e)
{
}
@@ -36,7 +36,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityCreeper(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityEgg.cs b/Substrate/SubstrateCS/Source/Entities/EntityEgg.cs
index 9b15a77..3b5de01 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityEgg.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityEgg.cs
@@ -18,7 +18,7 @@ namespace Substrate.Entities
{
}
- public EntityEgg (Entity e)
+ public EntityEgg (EntityTyped e)
: base(e)
{
}
@@ -36,7 +36,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityEgg(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityFallingSand.cs b/Substrate/SubstrateCS/Source/Entities/EntityFallingSand.cs
index 280cf9a..f93cdb7 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityFallingSand.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityFallingSand.cs
@@ -6,9 +6,9 @@ namespace Substrate.Entities
{
using Substrate.NBT;
- public class EntityFallingSand : Entity
+ public class EntityFallingSand : EntityTyped
{
- public static readonly SchemaNodeCompound FallingSandSchema = BaseSchema.MergeInto(new SchemaNodeCompound("")
+ public static readonly SchemaNodeCompound FallingSandSchema = EntityTyped.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "FallingSand"),
new SchemaNodeScaler("Tile", TagType.TAG_BYTE),
@@ -27,7 +27,7 @@ namespace Substrate.Entities
{
}
- public EntityFallingSand (Entity e)
+ public EntityFallingSand (EntityTyped e)
: base(e)
{
EntityFallingSand e2 = e as EntityFallingSand;
@@ -39,7 +39,7 @@ namespace Substrate.Entities
#region INBTObject Members
- public override Entity LoadTree (TagNode tree)
+ public override EntityTyped LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
@@ -69,7 +69,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityFallingSand(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityGhast.cs b/Substrate/SubstrateCS/Source/Entities/EntityGhast.cs
index d9758b7..eadd6a9 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityGhast.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityGhast.cs
@@ -18,7 +18,7 @@ namespace Substrate.Entities
{
}
- public EntityGhast (Entity e)
+ public EntityGhast (EntityTyped e)
: base(e)
{
}
@@ -36,7 +36,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityGhast(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityGiant.cs b/Substrate/SubstrateCS/Source/Entities/EntityGiant.cs
index c334091..29fa2de 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityGiant.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityGiant.cs
@@ -18,7 +18,7 @@ namespace Substrate.Entities
{
}
- public EntityGiant (Entity e)
+ public EntityGiant (EntityTyped e)
: base(e)
{
}
@@ -36,7 +36,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityGiant(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityItem.cs b/Substrate/SubstrateCS/Source/Entities/EntityItem.cs
index f13bbfd..59cf1f1 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityItem.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityItem.cs
@@ -6,9 +6,9 @@ namespace Substrate.Entities
{
using Substrate.NBT;
- public class EntityItem : Entity
+ public class EntityItem : EntityTyped
{
- public static readonly SchemaNodeCompound ItemSchema = BaseSchema.MergeInto(new SchemaNodeCompound("")
+ public static readonly SchemaNodeCompound ItemSchema = EntityTyped.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Item"),
new SchemaNodeScaler("Health", TagType.TAG_SHORT),
@@ -44,7 +44,7 @@ namespace Substrate.Entities
{
}
- public EntityItem (Entity e)
+ public EntityItem (EntityTyped e)
: base(e)
{
EntityItem e2 = e as EntityItem;
@@ -58,7 +58,7 @@ namespace Substrate.Entities
#region INBTObject Members
- public override Entity LoadTree (TagNode tree)
+ public override EntityTyped LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
@@ -93,7 +93,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityItem(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityMinecart.cs b/Substrate/SubstrateCS/Source/Entities/EntityMinecart.cs
index 9f54f3e..89b9ecf 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityMinecart.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityMinecart.cs
@@ -6,7 +6,7 @@ namespace Substrate.Entities
{
using Substrate.NBT;
- public class EntityMinecart : Entity
+ public class EntityMinecart : EntityTyped
{
public enum CartType
{
@@ -15,7 +15,7 @@ namespace Substrate.Entities
FURNACE = 2,
}
- public static readonly SchemaNodeCompound MinecartSchema = BaseSchema.MergeInto(new SchemaNodeCompound("")
+ public static readonly SchemaNodeCompound MinecartSchema = EntityTyped.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Minecart"),
new SchemaNodeScaler("Type", TagType.TAG_BYTE),
@@ -33,7 +33,7 @@ namespace Substrate.Entities
{
}
- public EntityMinecart (Entity e)
+ public EntityMinecart (EntityTyped e)
: base(e)
{
EntityMinecart e2 = e as EntityMinecart;
@@ -45,7 +45,7 @@ namespace Substrate.Entities
#region INBTObject Members
- public override Entity LoadTree (TagNode tree)
+ public override EntityTyped LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
@@ -84,7 +84,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityMinecart(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityMinecartChest.cs b/Substrate/SubstrateCS/Source/Entities/EntityMinecartChest.cs
index 69057f3..7bd2bd3 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityMinecartChest.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityMinecartChest.cs
@@ -23,7 +23,7 @@ namespace Substrate.Entities
_items = new ItemCollection(_CAPACITY);
}
- public EntityMinecartChest (Entity e)
+ public EntityMinecartChest (EntityTyped e)
: base(e)
{
EntityMinecartChest e2 = e as EntityMinecartChest;
@@ -44,7 +44,7 @@ namespace Substrate.Entities
#region INBTObject Members
- public override Entity LoadTree (TagNode tree)
+ public override EntityTyped LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
@@ -75,7 +75,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityMinecartChest(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityMinecartFurnace.cs b/Substrate/SubstrateCS/Source/Entities/EntityMinecartFurnace.cs
index 83ba287..2c6de16 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityMinecartFurnace.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityMinecartFurnace.cs
@@ -42,7 +42,7 @@ namespace Substrate.Entities
{
}
- public EntityMinecartFurnace (Entity e)
+ public EntityMinecartFurnace (EntityTyped e)
: base(e)
{
EntityMinecartFurnace e2 = e as EntityMinecartFurnace;
@@ -56,7 +56,7 @@ namespace Substrate.Entities
#region INBTObject Members
- public override Entity LoadTree (TagNode tree)
+ public override EntityTyped LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
@@ -90,7 +90,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityMinecartFurnace(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityMob.cs b/Substrate/SubstrateCS/Source/Entities/EntityMob.cs
index 1f93868..a6fda35 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityMob.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityMob.cs
@@ -6,9 +6,9 @@ namespace Substrate.Entities
{
using Substrate.NBT;
- public class EntityMob : Entity
+ public class EntityMob : EntityTyped
{
- public static readonly SchemaNodeCompound MobSchema = BaseSchema.MergeInto(new SchemaNodeCompound("")
+ public static readonly SchemaNodeCompound MobSchema = EntityTyped.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Mob"),
new SchemaNodeScaler("AttackTime", TagType.TAG_SHORT),
@@ -56,7 +56,7 @@ namespace Substrate.Entities
{
}
- public EntityMob (Entity e)
+ public EntityMob (EntityTyped e)
: base(e)
{
EntityMob e2 = e as EntityMob;
@@ -71,7 +71,7 @@ namespace Substrate.Entities
#region INBTObject Members
- public override Entity LoadTree (TagNode tree)
+ public override EntityTyped LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
@@ -107,7 +107,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityMob(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityMonster.cs b/Substrate/SubstrateCS/Source/Entities/EntityMonster.cs
index adfd477..a0015a1 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityMonster.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityMonster.cs
@@ -18,7 +18,7 @@ namespace Substrate.Entities
{
}
- public EntityMonster (Entity e)
+ public EntityMonster (EntityTyped e)
: base(e)
{
}
@@ -36,7 +36,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityMonster(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityPainting.cs b/Substrate/SubstrateCS/Source/Entities/EntityPainting.cs
index 6c62a3f..fbb43d2 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityPainting.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityPainting.cs
@@ -6,7 +6,7 @@ namespace Substrate.Entities
{
using Substrate.NBT;
- public class EntityPainting : Entity
+ public class EntityPainting : EntityTyped
{
public enum DirectionType
{
@@ -16,7 +16,7 @@ namespace Substrate.Entities
SOUTH = 3,
}
- public static readonly SchemaNodeCompound PaintingSchema = BaseSchema.MergeInto(new SchemaNodeCompound("")
+ public static readonly SchemaNodeCompound PaintingSchema = EntityTyped.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Painting"),
new SchemaNodeScaler("Dir", TagType.TAG_BYTE),
@@ -67,7 +67,7 @@ namespace Substrate.Entities
{
}
- public EntityPainting (Entity e)
+ public EntityPainting (EntityTyped e)
: base(e)
{
EntityPainting e2 = e as EntityPainting;
@@ -83,7 +83,7 @@ namespace Substrate.Entities
#region INBTObject Members
- public override Entity LoadTree (TagNode tree)
+ public override EntityTyped LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
@@ -121,7 +121,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityPainting(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityPig.cs b/Substrate/SubstrateCS/Source/Entities/EntityPig.cs
index 0e61368..902ce3a 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityPig.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityPig.cs
@@ -27,7 +27,7 @@ namespace Substrate.Entities
{
}
- public EntityPig (Entity e)
+ public EntityPig (EntityTyped e)
: base(e)
{
EntityPig e2 = e as EntityPig;
@@ -39,7 +39,7 @@ namespace Substrate.Entities
#region INBTObject Members
- public override Entity LoadTree (TagNode tree)
+ public override EntityTyped LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
@@ -69,7 +69,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityPig(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityPigZombie.cs b/Substrate/SubstrateCS/Source/Entities/EntityPigZombie.cs
index b88fe9a..d212735 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityPigZombie.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityPigZombie.cs
@@ -18,7 +18,7 @@ namespace Substrate.Entities
{
}
- public EntityPigZombie (Entity e)
+ public EntityPigZombie (EntityTyped e)
: base(e)
{
}
@@ -36,7 +36,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityPigZombie(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityPrimedTnt.cs b/Substrate/SubstrateCS/Source/Entities/EntityPrimedTnt.cs
index c574202..16b818e 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityPrimedTnt.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityPrimedTnt.cs
@@ -6,9 +6,9 @@ namespace Substrate.Entities
{
using Substrate.NBT;
- public class EntityPrimedTnt : Entity
+ public class EntityPrimedTnt : EntityTyped
{
- public static readonly SchemaNodeCompound PrimedTntSchema = BaseSchema.MergeInto(new SchemaNodeCompound("")
+ public static readonly SchemaNodeCompound PrimedTntSchema = EntityTyped.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "PrimedTnt"),
new SchemaNodeScaler("Fuse", TagType.TAG_BYTE),
@@ -27,7 +27,7 @@ namespace Substrate.Entities
{
}
- public EntityPrimedTnt (Entity e)
+ public EntityPrimedTnt (EntityTyped e)
: base(e)
{
EntityPrimedTnt e2 = e as EntityPrimedTnt;
@@ -39,7 +39,7 @@ namespace Substrate.Entities
#region INBTObject Members
- public override Entity LoadTree (TagNode tree)
+ public override EntityTyped LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
@@ -69,7 +69,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityPrimedTnt(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntitySheep.cs b/Substrate/SubstrateCS/Source/Entities/EntitySheep.cs
index 71b6e18..de247c0 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntitySheep.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntitySheep.cs
@@ -35,7 +35,7 @@ namespace Substrate.Entities
{
}
- public EntitySheep (Entity e)
+ public EntitySheep (EntityTyped e)
: base(e)
{
EntitySheep e2 = e as EntitySheep;
@@ -48,7 +48,7 @@ namespace Substrate.Entities
#region INBTObject Members
- public override Entity LoadTree (TagNode tree)
+ public override EntityTyped LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
@@ -80,7 +80,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntitySheep(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntitySkeleton.cs b/Substrate/SubstrateCS/Source/Entities/EntitySkeleton.cs
index 8beaecb..726b0f1 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntitySkeleton.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntitySkeleton.cs
@@ -18,7 +18,7 @@ namespace Substrate.Entities
{
}
- public EntitySkeleton (Entity e)
+ public EntitySkeleton (EntityTyped e)
: base(e)
{
}
@@ -36,7 +36,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntitySkeleton(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntitySlime.cs b/Substrate/SubstrateCS/Source/Entities/EntitySlime.cs
index 0b82c1f..9884777 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntitySlime.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntitySlime.cs
@@ -27,7 +27,7 @@ namespace Substrate.Entities
{
}
- public EntitySlime (Entity e)
+ public EntitySlime (EntityTyped e)
: base(e)
{
EntitySlime e2 = e as EntitySlime;
@@ -39,7 +39,7 @@ namespace Substrate.Entities
#region INBTObject Members
- public override Entity LoadTree (TagNode tree)
+ public override EntityTyped LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
@@ -69,7 +69,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntitySlime(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntitySnowball.cs b/Substrate/SubstrateCS/Source/Entities/EntitySnowball.cs
index 00d5d7a..cc44b9f 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntitySnowball.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntitySnowball.cs
@@ -18,7 +18,7 @@ namespace Substrate.Entities
{
}
- public EntitySnowball (Entity e)
+ public EntitySnowball (EntityTyped e)
: base(e)
{
}
@@ -36,7 +36,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntitySnowball(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntitySpider.cs b/Substrate/SubstrateCS/Source/Entities/EntitySpider.cs
index 7aa9fbc..7027f50 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntitySpider.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntitySpider.cs
@@ -18,7 +18,7 @@ namespace Substrate.Entities
{
}
- public EntitySpider (Entity e)
+ public EntitySpider (EntityTyped e)
: base(e)
{
}
@@ -36,7 +36,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntitySpider(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntitySquid.cs b/Substrate/SubstrateCS/Source/Entities/EntitySquid.cs
index 3aa979b..2cbbd32 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntitySquid.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntitySquid.cs
@@ -18,7 +18,7 @@ namespace Substrate.Entities
{
}
- public EntitySquid (Entity e)
+ public EntitySquid (EntityTyped e)
: base(e)
{
}
@@ -36,7 +36,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntitySquid(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityThrowable.cs b/Substrate/SubstrateCS/Source/Entities/EntityThrowable.cs
index 58d47cc..abb9dc8 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityThrowable.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityThrowable.cs
@@ -6,9 +6,9 @@ namespace Substrate.Entities
{
using Substrate.NBT;
- public class EntityThrowable : Entity
+ public class EntityThrowable : EntityTyped
{
- public static readonly SchemaNodeCompound ThrowableSchema = BaseSchema.MergeInto(new SchemaNodeCompound("")
+ public static readonly SchemaNodeCompound ThrowableSchema = EntityTyped.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeScaler("xTile", TagType.TAG_SHORT),
new SchemaNodeScaler("yTile", TagType.TAG_SHORT),
@@ -66,7 +66,7 @@ namespace Substrate.Entities
{
}
- public EntityThrowable (Entity e)
+ public EntityThrowable (EntityTyped e)
: base(e)
{
EntityThrowable e2 = e as EntityThrowable;
@@ -83,7 +83,7 @@ namespace Substrate.Entities
#region INBTObject Members
- public override Entity LoadTree (TagNode tree)
+ public override EntityTyped LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
@@ -123,7 +123,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityThrowable(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityWolf.cs b/Substrate/SubstrateCS/Source/Entities/EntityWolf.cs
index 5bb02e8..138176c 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityWolf.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityWolf.cs
@@ -43,7 +43,7 @@ namespace Substrate.Entities
{
}
- public EntityWolf (Entity e)
+ public EntityWolf (EntityTyped e)
: base(e)
{
EntityWolf e2 = e as EntityWolf;
@@ -57,7 +57,7 @@ namespace Substrate.Entities
#region INBTObject Members
- public override Entity LoadTree (TagNode tree)
+ public override EntityTyped LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
@@ -91,7 +91,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityPig(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entities/EntityZombie.cs b/Substrate/SubstrateCS/Source/Entities/EntityZombie.cs
index c3e8efc..d168e96 100644
--- a/Substrate/SubstrateCS/Source/Entities/EntityZombie.cs
+++ b/Substrate/SubstrateCS/Source/Entities/EntityZombie.cs
@@ -18,7 +18,7 @@ namespace Substrate.Entities
{
}
- public EntityZombie (Entity e)
+ public EntityZombie (EntityTyped e)
: base(e)
{
}
@@ -36,7 +36,7 @@ namespace Substrate.Entities
#region ICopyable Members
- public override Entity Copy ()
+ public override EntityTyped Copy ()
{
return new EntityZombie(this);
}
diff --git a/Substrate/SubstrateCS/Source/Entity.cs b/Substrate/SubstrateCS/Source/Entity.cs
index b761b8a..801df27 100644
--- a/Substrate/SubstrateCS/Source/Entity.cs
+++ b/Substrate/SubstrateCS/Source/Entity.cs
@@ -6,18 +6,10 @@ using Substrate.NBT;
namespace Substrate
{
- public interface IEntityContainer
- {
- List FindEntities (string id);
- List FindEntities (Predicate match);
-
- bool AddEntity (Entity ent);
-
- int RemoveEntities (string id);
- int RemoveEntities (Predicate match);
- }
-
- public class UntypedEntity : INBTObject, ICopyable
+ ///
+ /// The base Entity type for Minecraft Entities, providing access to data common to all Minecraft Entities.
+ ///
+ public class Entity : INBTObject, ICopyable
{
public class Vector3
{
@@ -32,7 +24,7 @@ namespace Substrate
public double Yaw { get; set; }
}
- public static readonly SchemaNodeCompound UTBaseSchema = new SchemaNodeCompound("")
+ private static readonly SchemaNodeCompound _schema = new SchemaNodeCompound("")
{
new SchemaNodeList("Pos", TagType.TAG_DOUBLE, 3),
new SchemaNodeList("Motion", TagType.TAG_DOUBLE, 3),
@@ -52,56 +44,84 @@ namespace Substrate
private short _air;
private byte _onGround;
+ ///
+ /// Gets or sets the global position of the entity in fractional block coordinates.
+ ///
public Vector3 Position
{
get { return _pos; }
set { _pos = value; }
}
+ ///
+ /// Gets or sets the velocity of the entity.
+ ///
public Vector3 Motion
{
get { return _motion; }
set { _motion = value; }
}
+ ///
+ /// Gets or sets the orientation of the entity.
+ ///
public Orientation Rotation
{
get { return _rotation; }
set { _rotation = value; }
}
+ ///
+ /// Gets or sets the distance that the entity has fallen, if it is falling.
+ ///
public double FallDistance
{
get { return _fallDistance; }
set { _fallDistance = (float)value; }
}
+ ///
+ /// Gets or sets the fire counter of the entity.
+ ///
public int Fire
{
get { return _fire; }
set { _fire = (short)value; }
}
+ ///
+ /// Gets or sets the reamining air availale to the entity.
+ ///
public int Air
{
get { return _air; }
set { _air = (short)value; }
}
+ ///
+ /// Gets or sets a value indicating whether the entity is currently touch the ground.
+ ///
public bool IsOnGround
{
get { return _onGround == 1; }
set { _onGround = (byte)(value ? 1 : 0); }
}
- public UntypedEntity ()
+ ///
+ /// Constructs a new generic with default values.
+ ///
+ public Entity ()
{
_pos = new Vector3();
_motion = new Vector3();
_rotation = new Orientation();
}
- public UntypedEntity (UntypedEntity e)
+ ///
+ /// Constructs a new generic by copying fields from another object.
+ ///
+ /// An to copy fields from.
+ public Entity (Entity e)
{
_pos = new Vector3();
_pos.X = e._pos.X;
@@ -126,7 +146,20 @@ namespace Substrate
#region INBTObject Members
- public UntypedEntity LoadTree (TagNode tree)
+ ///
+ /// Gets a representing the basic schema of an Entity.
+ ///
+ public static SchemaNodeCompound Schema
+ {
+ get { return _schema; }
+ }
+
+ ///
+ /// Attempt to load an Entity subtree into the without validation.
+ ///
+ /// The root node of an Entity subtree.
+ /// The returns itself on success, or null if the tree was unparsable.
+ public Entity LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null) {
@@ -157,7 +190,12 @@ namespace Substrate
return this;
}
- public UntypedEntity LoadTreeSafe (TagNode tree)
+ ///
+ /// Attempt to load an Entity subtree into the with validation.
+ ///
+ /// The root node of an Entity subtree.
+ /// The returns itself on success, or null if the tree failed validation.
+ public Entity LoadTreeSafe (TagNode tree)
{
if (!ValidateTree(tree)) {
return null;
@@ -166,6 +204,10 @@ namespace Substrate
return LoadTree(tree);
}
+ ///
+ /// Builds an Entity subtree from the current data.
+ ///
+ /// The root node of an Entity subtree representing the current data.
public TagNode BuildTree ()
{
TagNodeCompound tree = new TagNodeCompound();
@@ -195,9 +237,14 @@ namespace Substrate
return tree;
}
+ ///
+ /// Validate an Entity subtree against a basic schema.
+ ///
+ /// The root node of an Entity subtree.
+ /// Status indicating whether the tree was valid against the internal schema.
public bool ValidateTree (TagNode tree)
{
- return new NBTVerifier(tree, UTBaseSchema).Verify();
+ return new NBTVerifier(tree, _schema).Verify();
}
#endregion
@@ -205,35 +252,56 @@ namespace Substrate
#region ICopyable Members
- public UntypedEntity Copy ()
+ ///
+ /// Creates a deep-copy of the .
+ ///
+ /// A deep-copy of the .
+ public Entity Copy ()
{
- return new UntypedEntity(this);
+ return new Entity(this);
}
#endregion
}
- public class Entity : UntypedEntity, INBTObject, ICopyable
+ ///
+ /// A base entity type for all entities except entities.
+ ///
+ /// Generally, this class should be subtyped into new concrete Entity types, as this generic type is unable to
+ /// capture any of the custom data fields. It is however still possible to create instances of objects,
+ /// which may allow for graceful handling of unknown Entity types.
+ public class EntityTyped : Entity, INBTObject, ICopyable
{
- public static readonly SchemaNodeCompound BaseSchema = UTBaseSchema.MergeInto(new SchemaNodeCompound("")
+ private static readonly SchemaNodeCompound _schema = Entity.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeScaler("id", TagType.TAG_STRING),
});
private string _id;
+ ///
+ /// Gets the id (type) of the entity.
+ ///
public string ID
{
get { return _id; }
}
- public Entity (string id)
+ ///
+ /// Creates a new generic with the given id.
+ ///
+ /// The id (name) of the Entity.
+ public EntityTyped (string id)
: base()
{
_id = id;
}
- public Entity (Entity e)
+ ///
+ /// Constructs a new by copying an existing one.
+ ///
+ /// The to copy.
+ public EntityTyped (EntityTyped e)
: base(e)
{
_id = e._id;
@@ -242,7 +310,20 @@ namespace Substrate
#region INBTObject Members
- public virtual new Entity LoadTree (TagNode tree)
+ ///
+ /// Gets a representing the basic schema of an Entity.
+ ///
+ public static SchemaNodeCompound Schema
+ {
+ get { return _schema; }
+ }
+
+ ///
+ /// Attempt to load an Entity subtree into the without validation.
+ ///
+ /// The root node of an Entity subtree.
+ /// The returns itself on success, or null if the tree was unparsable.
+ public virtual new EntityTyped LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
@@ -254,7 +335,12 @@ namespace Substrate
return this;
}
- public virtual new Entity LoadTreeSafe (TagNode tree)
+ ///
+ /// Attempt to load an Entity subtree into the with validation.
+ ///
+ /// The root node of an Entity subtree.
+ /// The returns itself on success, or null if the tree failed validation.
+ public virtual new EntityTyped LoadTreeSafe (TagNode tree)
{
if (!ValidateTree(tree)) {
return null;
@@ -263,6 +349,10 @@ namespace Substrate
return LoadTree(tree);
}
+ ///
+ /// Builds an Entity subtree from the current data.
+ ///
+ /// The root node of an Entity subtree representing the current data.
public virtual new TagNode BuildTree ()
{
TagNodeCompound tree = base.BuildTree() as TagNodeCompound;
@@ -271,9 +361,14 @@ namespace Substrate
return tree;
}
+ ///
+ /// Validate an Entity subtree against a basic schema.
+ ///
+ /// The root node of an Entity subtree.
+ /// Status indicating whether the tree was valid against the internal schema.
public virtual new bool ValidateTree (TagNode tree)
{
- return new NBTVerifier(tree, BaseSchema).Verify();
+ return new NBTVerifier(tree, _schema).Verify();
}
#endregion
@@ -281,9 +376,13 @@ namespace Substrate
#region ICopyable Members
- public virtual new Entity Copy ()
+ ///
+ /// Creates a deep-copy of the .
+ ///
+ /// A deep-copy of the .
+ public virtual new EntityTyped Copy ()
{
- return new Entity(this);
+ return new EntityTyped(this);
}
#endregion
diff --git a/Substrate/SubstrateCS/Source/EntityCollection.cs b/Substrate/SubstrateCS/Source/EntityCollection.cs
index 9343e19..48ef47d 100644
--- a/Substrate/SubstrateCS/Source/EntityCollection.cs
+++ b/Substrate/SubstrateCS/Source/EntityCollection.cs
@@ -6,7 +6,7 @@ namespace Substrate
{
using NBT;
- public class EntityCollection : IEnumerable
+ public class EntityCollection : IEnumerable
{
private TagNodeList _entities;
@@ -23,9 +23,9 @@ namespace Substrate
_entities = entities;
}
- public List FindAll (string id)
+ public List FindAll (string id)
{
- List set = new List();
+ List set = new List();
foreach (TagNodeCompound ent in _entities) {
TagNode eid;
@@ -37,7 +37,7 @@ namespace Substrate
continue;
}
- Entity obj = EntityFactory.Create(ent);
+ EntityTyped obj = EntityFactory.Create(ent);
if (obj != null) {
set.Add(obj);
}
@@ -46,12 +46,12 @@ namespace Substrate
return set;
}
- public List FindAll (Predicate match)
+ public List FindAll (Predicate match)
{
- List set = new List();
+ List set = new List();
foreach (TagNodeCompound ent in _entities) {
- Entity obj = EntityFactory.Create(ent);
+ EntityTyped obj = EntityFactory.Create(ent);
if (obj == null) {
continue;
}
@@ -64,7 +64,7 @@ namespace Substrate
return set;
}
- public bool Add (Entity ent)
+ public bool Add (EntityTyped ent)
{
/*double xlow = _cx * XDim;
double xhigh = xlow + XDim;
@@ -106,7 +106,7 @@ namespace Substrate
return rem;
}
- public int RemoveAll (Predicate match)
+ public int RemoveAll (Predicate match)
{
int rem = _entities.RemoveAll(val =>
{
@@ -115,7 +115,7 @@ namespace Substrate
return false;
}
- Entity obj = EntityFactory.Create(cval);
+ EntityTyped obj = EntityFactory.Create(cval);
if (obj == null) {
return false;
}
@@ -132,7 +132,7 @@ namespace Substrate
#region IEnumerable Members
- public IEnumerator GetEnumerator ()
+ public IEnumerator GetEnumerator ()
{
return new EntityEnumerator(_entities);
}
@@ -148,11 +148,11 @@ namespace Substrate
#endregion
- public class EntityEnumerator : IEnumerator
+ public class EntityEnumerator : IEnumerator
{
private IEnumerator _enum;
- private Entity _cur;
+ private EntityTyped _cur;
public EntityEnumerator (TagNodeList entities)
{
@@ -161,7 +161,7 @@ namespace Substrate
#region IEnumerator Members
- public Entity Current
+ public EntityTyped Current
{
get
{
diff --git a/Substrate/SubstrateCS/Source/EntityFactory.cs b/Substrate/SubstrateCS/Source/EntityFactory.cs
index 20acd10..e657799 100644
--- a/Substrate/SubstrateCS/Source/EntityFactory.cs
+++ b/Substrate/SubstrateCS/Source/EntityFactory.cs
@@ -1,42 +1,41 @@
using System;
using System.Collections.Generic;
+using Substrate.Entities;
+using Substrate.NBT;
namespace Substrate
{
- using NBT;
- using Entities;
-
///
- /// Creates new instances of concrete types from a dynamic registry.
+ /// Creates new instances of concrete types from a dynamic registry.
///
- /// This factory allows specific objects to be generated as an NBT tree is parsed. New types can be
- /// registered with the factory at any time, so that custom types can be supported. By default, the standard
+ /// This factory allows specific objects to be generated as an NBT tree is parsed. New types can be
+ /// registered with the factory at any time, so that custom types can be supported. By default, the standard
/// Entities of Minecraft are registered with the factory at startup and bound to their respective 'id' fields.
public class EntityFactory
{
private static Dictionary _registry;
///
- /// Create a new instance of a concrete type by name.
+ /// Create a new instance of a concrete type by name.
///
- /// The name that a concrete type was registered with.
- /// A new instance of a concrete type, or null if no type was registered with the given name.
- public static Entity Create (string type)
+ /// The name that a concrete type was registered with.
+ /// A new instance of a concrete type, or null if no type was registered with the given name.
+ public static EntityTyped Create (string type)
{
Type t;
if (!_registry.TryGetValue(type, out t)) {
return null;
}
- return Activator.CreateInstance(t) as Entity;
+ return Activator.CreateInstance(t) as EntityTyped;
}
///
- /// Create a new instance of a concrete type by NBT node.
+ /// Create a new instance of a concrete type by NBT node.
///
/// A representing a single Entity, containing an 'id' field of the Entity's registered name.
- /// A new instance of a concrete type, or null if no type was registered with the given name.
- public static Entity Create (TagNodeCompound tree)
+ /// A new instance of a concrete type, or null if no type was registered with the given name.
+ public static EntityTyped Create (TagNodeCompound tree)
{
TagNode type;
if (!tree.TryGetValue("id", out type)) {
@@ -48,16 +47,16 @@ namespace Substrate
return null;
}
- Entity te = Activator.CreateInstance(t) as Entity;
+ EntityTyped te = Activator.CreateInstance(t) as EntityTyped;
return te.LoadTreeSafe(tree);
}
///
- /// Lookup a concrete type by name.
+ /// Lookup a concrete type by name.
///
- /// The name that a concrete type was registered with.
- /// The of a concrete type, or null if no type was registered with the given name.
+ /// The name that a concrete type was registered with.
+ /// The of a concrete type, or null if no type was registered with the given name.
public static Type Lookup (string type)
{
Type t;
@@ -69,10 +68,10 @@ namespace Substrate
}
///
- /// Registers a new concrete type with the , binding it to a given name.
+ /// Registers a new concrete type with the , binding it to a given name.
///
- /// The name to bind to a concrete type.
- /// The of a concrete type.
+ /// The name to bind to a concrete type.
+ /// The of a concrete type.
public static void Register (string id, Type subtype)
{
_registry[id] = subtype;
diff --git a/Substrate/SubstrateCS/Source/Player.cs b/Substrate/SubstrateCS/Source/Player.cs
index 3e46f7e..2d2adb6 100644
--- a/Substrate/SubstrateCS/Source/Player.cs
+++ b/Substrate/SubstrateCS/Source/Player.cs
@@ -6,9 +6,9 @@ using Substrate.NBT;
namespace Substrate
{
- public class Player : UntypedEntity, INBTObject, ICopyable, IItemContainer
+ public class Player : Entity, INBTObject, ICopyable, IItemContainer
{
- public static readonly SchemaNodeCompound PlayerSchema = UTBaseSchema.MergeInto(new SchemaNodeCompound("")
+ public static readonly SchemaNodeCompound PlayerSchema = Entity.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeScaler("AttackTime", TagType.TAG_SHORT),
new SchemaNodeScaler("DeathTime", TagType.TAG_SHORT),
diff --git a/Substrate/SubstrateCS/Substrate.csproj b/Substrate/SubstrateCS/Substrate.csproj
index 3d941cf..b3904cc 100644
--- a/Substrate/SubstrateCS/Substrate.csproj
+++ b/Substrate/SubstrateCS/Substrate.csproj
@@ -62,15 +62,17 @@
-
+
+
+
-
+
-
-
+
+
@@ -95,19 +97,17 @@
-
+
-
-
-
+
+
-
-
-
-
-
+
+
+
+
@@ -140,14 +140,14 @@
-
+
-
-
+
+
@@ -158,13 +158,12 @@
-
-
-
-
-
-
-
+
+
+
+
+
+