Terrain generator

Added a bunch of optimizations and restructuring to the map generation. Caves are hard, so that will be a problem solved another day.
I need to update this file to not use the import expansion. Also, this has the same race condition we had in CaveTest. I think It's amazing that this bug (race condition) wasn't noticeable on slower computers.