Move terrain to core

Fixes #799.