Either "e" or "e.getType()" is returns null

I would start by making sure all the Block variables in the "blocks" array are not null. Then make sure "e.getType()" doesn't return null.
e can't be null, assuming the list does not allow null elements (I assume it's an ArrayList). I think the problem is that e.getType() sometimes is null, and calling equals(...) on a null object throws a Nuppo.
You can check this out easily by replacing the line
1
| if(e.getType().equals(Material.AIR)){ |
with a test line:
1
| if(e.getType() == null){ |
which will draw all tiles that have null data.
It could be a concurrency problem. If your frame is set to visible before you have initialized your data, a repaint may be triggered before you're done setting everything up. Looking over your code with a debugger is a very good idea in this case.