/// <summary> /// Creates a deep copy of the <see cref="AlphaBlock"/>. /// </summary> /// <returns>A new <see cref="AlphaBlock"/> representing the same data.</returns> public AlphaBlock Copy() { AlphaBlock block = new AlphaBlock(_id, _data); block._tileEntity = _tileEntity.Copy(); return(block); }
/// <summary> /// Creates a deep copy of the <see cref="AlphaBlock"/>. /// </summary> /// <returns>A new <see cref="AlphaBlock"/> representing the same data.</returns> public AlphaBlock Copy() { AlphaBlock block = new AlphaBlock(_id, _data); if (_tileEntity != null) { block._tileEntity = _tileEntity.Copy(); } return(block); }
/// <summary> /// Updates a block in this collection with values from a <see cref="AlphaBlock"/> object. /// </summary> /// <param name="x">Local X-coordinate of a block.</param> /// <param name="y">Local Y-coordinate of a block.</param> /// <param name="z">Local Z-coordinate of a block.</param> /// <param name="block">A <see cref="AlphaBlock"/> object to copy block data from.</param> public void SetBlock(int x, int y, int z, AlphaBlock block) { SetID(x, y, z, block.ID); SetData(x, y, z, block.Data); TileEntity te = block.GetTileEntity(); if (te != null) { SetTileEntity(x, y, z, te.Copy()); } }
/// <summary> /// Crrates a new <see cref="AlphaBlock"/> from a given block in an existing <see cref="AlphaBlockCollection"/>. /// </summary> /// <param name="chunk">The block collection to reference.</param> /// <param name="lx">The local X-coordinate of a block within the collection.</param> /// <param name="ly">The local Y-coordinate of a block within the collection.</param> /// <param name="lz">The local Z-coordinate of a block within the collection.</param> public AlphaBlock(AlphaBlockCollection chunk, int lx, int ly, int lz) { _id = chunk.GetID(lx, ly, lz); _data = chunk.GetData(lx, ly, lz); TileEntity te = chunk.GetTileEntity(lx, ly, lz); if (te != null) { _tileEntity = te.Copy(); } }