Rewrite the bucket pickup system.

Shamelessly copied and edited from the forge wiki, which had shamelessly gotten it from the buildcraft code.