/// <summary> /// Set the metadata of a block in the chunk /// </summary> public virtual bool SetBlockMetadata(int par1, int par2, int par3, int par4) { ExtendedBlockStorage extendedblockstorage = storageArrays[par2 >> 4]; if (extendedblockstorage == null) { return(false); } int i = extendedblockstorage.GetExtBlockMetadata(par1, par2 & 0xf, par3); if (i == par4) { return(false); } IsModified = true; extendedblockstorage.SetExtBlockMetadata(par1, par2 & 0xf, par3, par4); int j = extendedblockstorage.GetExtBlockID(par1, par2 & 0xf, par3); if (j > 0 && (Block.BlocksList[j] is BlockContainer)) { TileEntity tileentity = GetChunkBlockTileEntity(par1, par2, par3); if (tileentity != null) { tileentity.UpdateContainingBlockInfo(); tileentity.BlockMetadata = par4; } } return(true); }
/// <summary> /// Return the metadata corresponding to the given coordinates inside a chunk. /// </summary> public virtual int GetBlockMetadata(int par1, int par2, int par3) { if (par2 >> 4 >= storageArrays.Length) { return(0); } ExtendedBlockStorage extendedblockstorage = storageArrays[par2 >> 4]; if (extendedblockstorage != null) { return(extendedblockstorage.GetExtBlockMetadata(par1, par2 & 0xf, par3)); } else { return(0); } }