Made emerald/wood pipes support vanilla's ISidedInventoy

Also cleaned up the code