The shape of your furnace is rotation agnostic. First: find the bock behind the one clicked (you get a facing value, offset by that ejection -1) then just check all the locations from there.
Additionally, you'll need to make your blocks invalidate the TE (if it exists) when broken. That will be trickier, but each block can figure it out (or just have the TE periodically validate itself)