How to implement Minecraft’s terrain generation?

I’m working on a server-compatible Minecraft client. That’s quite easy right now, as most of the gameplay is handled server-side, and the client simply has to take care of the rendering. Since the protocol is open source, that is definitely doable.

Now, when it comes to single-player, things are definitely harder, since now I’d have to do these things myself, and I don’t know how Minecraft’s internals work. However, some things can be reverse engineered, the physics and NPC behavior and the sorts should be able to be replicated, but specifically the world generation based on seeds bothers me.

How can I implement world generation in my custom client?