public TileEntity getChunkBlockTileEntity(int par1, int par2, int par3)
    {
        ChunkPosition var4 = new ChunkPosition(par1, par2, par3);
        TileEntity var5 = (TileEntity)this.chunkTileEntityMap.get(var4);
        
        if (var5 != null && var5.isInvalid())
        {
            chunkTileEntityMap.remove(var4);
            var5 = null;
        }

        if (var5 == null)
        {
            int var6 = this.getBlockID(par1, par2, par3);
            int meta = getBlockMetadata(par1, par2, par3);
            
            if (var6 <= 0 || Block.blocksList[var6] == null || !Block.blocksList[var6].hasTileEntity(meta))
            {
                return null;
            }

            if (var5 == null)
            {
                var5 = Block.blocksList[var6].getTileEntity(meta);
                this.worldObj.setBlockTileEntity(this.xPosition * 16 + par1, par2, this.zPosition * 16 + par3, var5);
            }

            var5 = (TileEntity)this.chunkTileEntityMap.get(var4);
        }

        return var5;
    }