This is #24 combined with https://github.com/regisb/opencraft/pull/1 and rebased against master
CC @regisb