From fa1052ab16dba785e1f0f85e8ba345330583ee28 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Sun, 14 Aug 2011 18:22:23 +0000 Subject: [PATCH] TileEntity crash bugs fixed. --- Substrate/SubstrateCS/Source/AlphaBlock.cs | 4 +++- Substrate/SubstrateCS/Source/AlphaBlockCollection.cs | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Substrate/SubstrateCS/Source/AlphaBlock.cs b/Substrate/SubstrateCS/Source/AlphaBlock.cs index d56c289..248a28e 100644 --- a/Substrate/SubstrateCS/Source/AlphaBlock.cs +++ b/Substrate/SubstrateCS/Source/AlphaBlock.cs @@ -184,7 +184,9 @@ namespace Substrate public AlphaBlock Copy () { AlphaBlock block = new AlphaBlock(_id, _data); - block._tileEntity = _tileEntity.Copy(); + if (_tileEntity != null) { + block._tileEntity = _tileEntity.Copy(); + } return block; } diff --git a/Substrate/SubstrateCS/Source/AlphaBlockCollection.cs b/Substrate/SubstrateCS/Source/AlphaBlockCollection.cs index 0176487..931154b 100644 --- a/Substrate/SubstrateCS/Source/AlphaBlockCollection.cs +++ b/Substrate/SubstrateCS/Source/AlphaBlockCollection.cs @@ -204,7 +204,10 @@ namespace Substrate SetID(x, y, z, block.ID); SetData(x, y, z, block.Data); - SetTileEntity(x, y, z, block.GetTileEntity().Copy()); + TileEntity te = block.GetTileEntity(); + if (te != null) { + SetTileEntity(x, y, z, te.Copy()); + } } #region IBoundedBlockCollection Members