Added some safety checks and better handling of tile-to-blockstate

Signed-off-by: Irmo van den Berge <bergerkiller@gmail.com>