Block builder is a new general case of treegen

An abstract, (hopefully) easy to extend class to make implementation of
treegens and other structures much easier.