Advanced multi-block refinery

Initial implementation is done. Actual functionality is yet to come, but I'm submitting this for @SpaceToad's review